A site-package created by Esri to expose ArcObjects to Python.

learn more… | top users | synonyms (1)

7
votes
2answers
2k views

Select and copy features in ArcMap using Python add-in tool

I'm trying to add a tool to an add-in toobar to select features from an existing feature class and copy them across to another feature class. I need two tools, one for a point and one for a rectangle. ...
3
votes
1answer
179 views

Beginning Arcpy: Asking for a quick review of my script

I cobbled this code together from ESRI documentation and stackexchange answers. I tried to use SearchCursor(points, fields=fieldname) but I get this error: TypeError: SearchCursor() got an ...
8
votes
3answers
439 views

Is there a way to tell the geodatabase version using Python?

I want to find out if either a file or personal geodatabase is 9.3, 10.0, 10.1, etc Is there a way to do this using Python?
4
votes
1answer
227 views

changing symbology

I have problem with my script. Layers are in one geodatabase, and have names like: orne1942, orne 2003, orne 2009 (the same forpart e.g. orne). Script should changing symbology layers wich have the ...
3
votes
1answer
359 views

Is it possible to get the coordinates of a user clicked point in a current MXD with ArcGIS 10.0 ArcPy?

I would like to know if it is possible to get the coordinates from a user clicked point in the current map document - arcpy.mapping.MapDocument("CURRENT")?
4
votes
2answers
496 views

Randomly select a record to update using arcpy.da.UpdateCursor

This question is related to my question here. What I would like to do is use a cursor with a where clause to select a number of records. For each row, the values in two fields, TYPE_A and TYPE_B ...
1
vote
1answer
298 views

How to save an existing LYR file to use a relative path *and* have the LYR be v9.3 compatible?

Not sure if this is possible - I am writing a python script to convert LYR files to use relative paths and save the LYR as a 9.3 LYR file. I can do each one individually, but not together. ... # ...
5
votes
2answers
550 views

Correct usage of a counter using arcpy.da.UpdateCursor

In the Python code inside a Calculate Value tool in my model, I have the following: getNum("%Selected Features%") def getNum(ftr): lst = [4, 11, 15] #values for SQL expression x = 20 fields ...
1
vote
1answer
150 views

cannot print listRasters

I'm trying to run this very simple script to check a problem in another more comlpex one. import arcpy arcpy.env.workspace= 'C:\\Users\\Umberto\\Desktop\\Prove_Script\\Karakoram\\temporary_01' rst= ...
3
votes
1answer
1k views

ArcGIS 10.0/10.1 - arcpy - automate projection tool with different datum or projection

I am getting stuck with a task that is slightly different from the posts I found so far on this same website. Assumption: all layers have a defined coordinate system Problem: I would like to ...
3
votes
1answer
854 views

getting the specified geographic transformation, or at least the GCS, of a data frame

First, the TLDR digest: I'm getting a bogus value from dataFrame.geographicTransformations on some machines; how do I get the correct value as shown in the properties dialog? and/or Given a spatial ...
2
votes
2answers
471 views

The name contains invalid characters

I'm having a problem with the following script. When listing parameters that are optional I've used the "" before, so I can't figure out why this isn't working. import arcpy import os ...
3
votes
1answer
164 views

shapefile batch clip and merge combined

I have two shapefiles, one is polyline, the other polygon. For each polygon I would like to clip the polyline vectors inside. Using arcpy I already found part of a possible solution: ...
1
vote
1answer
56 views

How to use in_field_map parameter of CreateCompositeAddressLocator_geocoding?

I would like to know if anyone who has worked with the CreateCompositeAddressLocator_geocoding method knows how the "in_field_map" parameter is formed?
1
vote
0answers
166 views

Table record counts change when using python tool

I have a python tool which investigates mxd files and clips/projects and exports all visible datasets. Recently I've found that the record counts (even on non-clipped data) is different. It's ok if I ...
3
votes
1answer
2k views

Creating empty group layer within existing group layer using arcpy.mapping?

Referencing this question, Add a new group layer with python ArcGIS 10, I'm trying to use python to add a empty group within a group layer. So far I'm able to add a empty group within the map ...
4
votes
1answer
483 views

Access Metadata from ArcSDE-tables using python

Is it possible to access the metadata of a feature class in a ArcSDE-data, using arcpy / python (on Arcgis 10.0). I suppose I could export the metadata to xml and parse the xml, but is there a more ...
2
votes
0answers
125 views

Problem to transform events from one route to another

I have a road feature class layer containing parts like 1_10, 1_20. 2_10, 2_20... etc. 1_, 2_ is later used to create the route and _10, _20 is indicating the direction (the road feature classes were ...
2
votes
4answers
452 views

Error When Trying to Run Slope Analysis Script

I have written a script which is supposed to loop through all the rasters in a folder and perform a slope analysis on each raster and save the results in another folder. I keep getting the following ...
1
vote
1answer
163 views

Include Python Script with ArcObjects Addin

I'm building addin for 10.1 and need a method (ConvertToMSD) that's only available in ArcPY. I've figured out out how to execute a python script from an ArcObjects addin: Calling arcpy/python from ...
3
votes
3answers
425 views

How do I sort polygons by their latitude?

We have a set of polygons which we would like to sort and number according to their latitude. This will make it easier for local authorities to relate to the numbers of the objects. I have looked ...
0
votes
2answers
119 views

Using 3D Raster Domain to get polygon of raster - but stripping Z and M values

I'm trying to convert a number of large, floating point rasters into polygons so I can view overlaps etc. I've been using 3D Raster Domain sucessfully to do this. The only problem is that the polygons ...
6
votes
2answers
255 views

Python scripting- compute statistics

I'm new to Python but I've heard is a good way to automate tasks. I have thousands of point shapefiles and need to extract the maximum value of each one and put them in a new table. I'll appreciate ...
3
votes
2answers
5k views

Read specific column and row value from a text file using Python [closed]

I have a text file as following: 1.25 177. 1.50 220. 2.00 272. 5.00 427. 10.00 556. 25.00 763. 50.00 916. ...
15
votes
5answers
2k views

How to make a GIS inventory?

My office will be seeing a big change in its GIS section. This section has been operational since the 1980's and has a huge collection of GIS data (i.e., shapefiles, raster files, data, etc) but never ...
7
votes
2answers
453 views

How to create a solar intensity map for a garden plot?

I'm interested in creating a raster surface that depicts the average solar intensity per unit area for a small garden plot. I imagine the inputs into the model would be the following: Plot ...
4
votes
1answer
155 views

How to select points within polygon constrained by field?

I've created a polygon from a raster dataset: arcpy.RasterToPolygon_conversion(RasterInt, "C:/arc/poly_int.shp", "NO_SIMPLIFY", "Value") The 'value' field has numbers 1-37, which map to the ID ...
6
votes
2answers
379 views

Possible to Call ArcPy Script From AddIn in ArcGIS 10.0?

Is it possible to call an ArcPy script from a Java/.Net addin in ArcGIS 10.0?
6
votes
1answer
189 views

What percentage of ArcGIS users are using version 10.1 already?

I'm planning on building an add-in using ArcPy, but some of the functionality I need is only available in 10.1. I want to distribute this add-in and was wondering if making it 10.1 only would limit ...
2
votes
2answers
1k views

rename feature layer fields

Guys and gals could you please provide me with a sample code as to how to rename a field name in a Feature Layer or Table. I've been trying to use the FieldInfo object to do so over the last couple ...
2
votes
1answer
292 views

ModelBuilder: Multiple Iterators and Clipping

I have two separate polygon layers. One layer consists of voronoi polygons. The second layer consists of buffers, many of which overlap. I need to do is iterate through each voronoi, clip only the ...
2
votes
1answer
575 views

How to use arcpy.mapping to batch export layer to KML?

I am trying to export map layers from an MXD to KML using arcpy with the following code: import arcpy, os, sys, traceback arcpy.env.overwriteOutput = True mxd = ...
4
votes
2answers
293 views

Running python 2.6 and 2.7 in ArcGIS 10.0

I figure that there must be a way for me to run python 2.6 and 2.7 on the same computer. I've got a program that requires 2.7, but ArcGIS requires 2.6. I'd like to be able to run both programs at ...
1
vote
3answers
137 views

Applying rotation before FeatureToRaster_conversion?

I am converting polygon shapefiles to rasters. With arcpy I am using the function FeatureToRaster_conversion. gp.FeatureToRaster_conversion(InFeatures, InField, OutRaster, InCellSize) This function ...
3
votes
2answers
269 views

Get the junction id for the roads in a network dataset

I have a network dataset with roads and junctions. I am wondering what class I can use in arcpy to extract FromJunctionId and the ToJunctionId for each road segment in the network dataset. Thanks.
2
votes
3answers
460 views

Field Type Date invalid when run in Python, but not in Model

Using ArcGIS Desktop Advanced 10.1 and PyScripter When running the arcpy.FeatureClassToFeatureClass_conversion, I get the error that the field type of Date is not valid. However, when running this ...
0
votes
1answer
390 views

How to add a graphic table element in Python without Production Mapping extension?

I'd like to add a table in the Map Layout that includes only items visible at the current extent of the dataset. I know that the Production Mapping Extension lets you insert a Graphic Table Element ...
9
votes
1answer
355 views

Is there a way to use ArcPy and PyGRASS tools in the same Python script?

I´m trying to write a Python script, that includes different ArcPy / ArcGIS commands and want to combine it with GRASS geoprocessing tools. Unfortunately importing the GRASS libraries doesn´t work. ...
2
votes
1answer
286 views

Saving rasters in a Python for loop fails only on last iteration

I'm a newcomer to Python scripting and I'm having what's seemingly a very simple problem but one that's stumped me enough to send me posting to these forums for the first time. I'm using a for loop ...
2
votes
3answers
647 views

arcpy: get list of adjacent lines per line

I am working with polylines with hundreds of thousands of features, and would like to write a script that returns the OIDs of all lines adjacent (intersecting with) each line. I have been ...
4
votes
0answers
257 views

Make Graph (Data Management), Changing item names in legend

I'm having python produce a multi-series graph. How do you change the series name in the legend, the default being Vertical Bar, Vertical Bar1, Vertical Bar2.... Thanks for the help ...
7
votes
1answer
859 views

How to prompt for user input during ArcGIS Python script tool execution?

I want to prompt for user input after all parameters have been specified for the script tool. I've seen many forum posts and stackexchange questions about this, and they all conclude that it's ...
1
vote
0answers
108 views

jagged edges in mosaic DEM

I encounter edge issues when trying to mosaic USGS NED DEMs in ArcGIS 10.0.0. After projection and aggregation, I attempt arcpy.MosaicToNewRaster_management(). I've reproduced the same results using ...
5
votes
1answer
199 views

parallelization of raster mosaic

I would like to create a raster mosaic of the national USGS NED 30m DEM (~50 GB). I'd like to leverage parallel processing using python multiprocessing module where possible. I'm using ArcGIS 10.0. My ...
0
votes
1answer
500 views

Invalid data source issue when trying to use lyr.replaceDataSource

When I run the following code in an open mapdocument, it executes and does what I want it to, replace the datasource of the Indianacounty_shp layer with the County_Boundary feature class. import ...
7
votes
3answers
1k views

python.exe has stopped working

A python script was written about 18 months ago by a person who has now left. It produced the required outputs then. I've been asked to run it again but with different (finer resolution) data ...
0
votes
1answer
1k views

Runtime error <type 'exceptions.TypeError'>: 'unicode' object is not callable

I'm working on a script to replace a layer datasource, and I'm getting an error I cannot figure out. When I run the following code in a python window inside ArcMap, I get a "Runtime error : 'unicode' ...
5
votes
3answers
1k views

Merge Spatially Coincident Features in the Same Feature Class

I need a way to programatically merge grid cells (polygon 15x15m) that are directly on top of each other and add together some of their attributes. I am working in ArcGIS 10.1 with the data stored as ...
4
votes
4answers
198 views

How to determine if all points on a map are identical in arcpy?

My eventual goal is to automate kernel density calculations for a large corpus of point data; however, if all points are identical (for example, if there are 7 points all stacked on top of one another ...
1
vote
1answer
350 views

arcpy JoinField_managment RuntimeError

So, I've been banging my head against the wall the last few days trying to figure out what's wrong with my script. It's suppose to pull weekly flu data from a department of health website, parse it ...