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

learn more… | top users | synonyms (1)

3
votes
1answer
1k views

How to detect duplicate attribute values in a table using ArcPy

In ArcMap, the right-click Summarize option very quickly creates a frequency listing of the chosen field: Note that the count field shows the count of duplicate values. How can I access this ...
4
votes
2answers
602 views

Arcpy remove invalid character

I've built a model that takes the name of the Excel worksheet containing xy data, and uses that name as the name of the output shapefile. ( Worksheet "massachusetts_sightings" in an xlsx becomes ...
1
vote
1answer
770 views

How to Set up Data Driven Pages using arcpy?

I've read a lot about the topic data driven pages. I'm writing a python script for ArcGIS and I've defined my stripmap using the arcpy.StripMapIndexFeatures_cartography command and now I have to set ...
19
votes
1answer
1k views

How to Split a Concave Polygon Into Convex Polygons in Arcpy?

I'm looking for a tool or algorithm to detect concave polygons and split them into convex polygons. Like explained in the picture, the blue polygon is split into A and B polygons I'm using Arcpy ...
1
vote
2answers
611 views

pour point user click input over map for watershed delineation

I have a drainage density map and i want to interactively retrieve watershed by clicking a point on map. Once I zoomed to an area of interest and click the highest accumulation point of my choice then ...
3
votes
2answers
924 views

Getting values from attribute table and inserting another table

I have line feature class of a river network and “FromTo” table. Lines are dissolved so they are not segmented from junctions. I need to write a Python script in ArcGIS to do following: Begin from ...
4
votes
2answers
1k views

arcpy overwrite files in a geodatabase file

I'm writing a python script, I've got an mxd and its workspace is a geodatabase file with all the files I need into. The problem I'm encountering in testing and writing code is that, despite of the ...
2
votes
1answer
2k views

How to calculate polyline azimuth or polyline direction?

I am looking for a Python code block to calculate azimuth per each polyline feature. So far I have been able to use the following Python code to calculate bearing: 180 + math.atan2(( ...
1
vote
1answer
402 views

Why does arcpy append from file geodatabase to SDE fail?

I'm trying to append a feature class from a file geodatabase to an Arcsde featureclass using this line of code: arcpy.Append_management("parcel_copy", sde_path+"parcel" ,"NO_TEST") This line works ...
5
votes
2answers
550 views

arcpy - how to check if a domain contains a particular coded value?

How can I check if a domain contains a particular coded value? How to check if domain already exists? shows how to verify whether a domain exists in a geodatabase. However, I can't see how to check ...
6
votes
1answer
421 views

Why are results from Python tool not in Results window?

I am relatively new to ArcPy 10. and I want to return the list of feature class from a dataset. I can see them through the message, but cannot see them from the result window. Actually there are only ...
4
votes
2answers
907 views

How to programmatically work with featureclasses from multiple geodatabases?

I have produced a Python script which creates multiple buffers of specific (listed) featureclasses within a geodatabase. This is achieved by running each feature through a for loop. I would like to ...
6
votes
1answer
246 views

Why does tool take longer to run when in Python script?

I have written a python script that does some euclidean allocation. For that I use arcpy.gp.EucAllocation_sa() method. Now, my python script takes 30-40% extra time than spatial analyst euclidean ...
3
votes
3answers
2k views

How to create lines from points pair coordinates with arcpy?

I've got some points pair coordinates (start and end points) which I have to transform into lines. Until now, I used an append of both the coordinates in a pippo.Point(), a pippo.CalculateGeometry() ...
2
votes
1answer
677 views

How can I use a variable to specify which field to update with arcpy.UpdateCursor?

I am writing a script that cycles through several different point shapefiles, finds how many lie within a given area and the writes the outcome to a table in an Access database. I've used an search ...
41
votes
10answers
3k views

Alternatives to using Arcpy

I seem to use ESRI's Arcpy site package for virtually all of my python geoprocessing. To ESRI's credit, these are an incredible suite of tools that can help accomplish a great deal. However, I would ...
1
vote
2answers
80 views

Automating attribute completion of new polygons

Good Afternoon I am currently outlining property boundaries and then copying and pasting in the necessary attributes on a daily basis. I would like to speed up this process and remove the chance of ...
2
votes
0answers
793 views

Why am I getting an ERROR 000728: Field *fieldname* does not exist within table even though field exists?

I do some script for a shapefile's table. And this script works for 2 fields and do not for other ones, because of: ERROR 000728: Field FID_158_01 does not exist within table But this field is ...
2
votes
2answers
663 views

Delete all fields from feature class with arcpy

I want to delete all of the fields from a feature class in a simple tricky way, I don't want to loop over the fields because this method is very slow in arcpy. I'm using a polygon feature class, I ...
1
vote
0answers
259 views

ArcGIS/arcpy: Geometry object comparison methods not working. Do they take z values into account?

I have an arcpy script that makes calculations based on an input PolygonZ feature class. What I need to do in several places in the script is test whether a point falls within a polygon in 2D. In ...
2
votes
1answer
376 views

How to add new data frame(s) to map using ArcPy?

I want to add a 2nd data frame to an existing "*.mxd" file. Right now, i see option to add layers and edit properties of "CURRENT" data frame but could not figure out how to add a new one and export ...
15
votes
4answers
713 views

How are people using Python data structures and classes in Arcpy?

This question may expose my ignorance on programming but I'm curious about how people are using different python data structures within Arcpy. This page lists the data structures in Python. I ...
3
votes
1answer
561 views

How to pan to a specific feature using arcpy?

I am attempting to use python and arcpy to automate the creation of some standardized maps I need to export for feature classes from various projects. I have a set of points and I need to export a ...
2
votes
2answers
1k views

how to get ALL FIELD NAMES from table? (using arcpy.ListFields)

I have a table: , Script at ModelBuilder's "calculate values": Expression: a("%path%") Code BLOCK: def a(path): fields = arcpy.ListFields(path,"FID_*") for field in fields: return ...
5
votes
2answers
2k views

How to clip/export multiple selected vector layers in a map to extent of another raster/vector layer in ArcGIS?

Is there a way to clip/export selected vector layers (more than one) in a map to the extent of another raster/vector layer at a time?? in Arcgis or any other software. I am using Arcgis10. I am ...
2
votes
2answers
1k views

How to clip multiple raster datasets with county polygons?

The example below shows three raster (i.e. in black) and a single county polygon feature class. How can I clip/extract by mask the rasters by their corresponding county polygons (i.e. Edwards, Clark, ...
0
votes
1answer
828 views

Why do i get an input error no module named arcpy when i try and import it into pythonwin?

Here is the error i get when i use the import arcpy command in pythonwin: Traceback (most recent call last): File "", line 1, in ImportError: No module named arcpy Can any one tell me how to fix ...
4
votes
2answers
304 views

focal statistics with variable radius

is there an easy way to do focal statistics on a raster, with a variable radius for the neighbourhood to be searched? As in: that search radius would be stored in another raster? i tried something ...
5
votes
2answers
184 views

Using newly created features in the next part of a python script

Good Afternoon I am trying to write a python script which buffers a large number of features from a geodatabase (but not all) and then dissolves the newly created buffer shapefiles together. ...
0
votes
0answers
148 views

How to iterate throught fields names in a table and change row values?

I got table like that one (Example). I need to change 0 to 1 and -1 to 0 in each field except first and second. The problem is that every time i have different number of fields and field name is ...
1
vote
1answer
114 views

ResultObject: Error in getting output

I am getting "ResultObject: Error in getting output" message when I run the following code. I know it has something to do with "os.path.join" but can't figure out what. Thanks. Sam import arcpy ...
2
votes
3answers
380 views

Is there a way in arcpy to convert map units from feet to decimal degrees?

This is my problem: I have an arcpy script that finds the XMax, XMin, YMax, and YMin of a polygon. It shows the results in feet, but I want them to be in decimal degrees. In ArcMap I can change the ...
5
votes
1answer
226 views

Adding kernel density output to map with ArcPy

I am trying to emulate the behavior of the Kernel Density tool from the ArcMap 10 GUI in a script; in other words, I want to calculate the density of a dataset, and add the visual result to a map. If ...
2
votes
1answer
239 views

Python script for Data Driven Pages to run a series of DDP at once?

I have a several different polygon shapefiles that I am using to create individual maps for each polygon within the shapefile. The layout is the same for each map, the only thing that changes is the ...
10
votes
2answers
228 views

Count raster value in a bounding box (spatial extent)

I have simple question: given a bounding box, how can I count the number of specific values (say, I am interested in the number of value == 1 ) in a raster in 1) arcpy, or 2) raster package in R?
2
votes
1answer
236 views

Python add-in won't buffer from output layer

I have a simple add-in script for Arcmap 10.1 to create a toolbar, select a layer from a drop down list of the current layers in the project, buffer that layer four-miles, then use the resulting ...
3
votes
1answer
728 views

How to write a python script to give multiple buffers of different sizes in ArcGIS?

I want to write a loop that will cause the output to be multiple buffer shapefiles. For example I want a circle buffer of 50ft, 100ft, 150ft..... Can anyone help? I'm new to this and am trying to ...
1
vote
1answer
71 views

Change printer for a specific map document from Arcpy

Is it possible to change the printer for a particular map document from ArcPy? The mxd is saved with the default printer settings, and I know with the PrintMap() function one can specify the printer ...
3
votes
2answers
699 views

Trouble finding YMin and YMax of a shapefile in ArcMap 10 and Arcpy

I want a python script that tells me the Xmin, Xmax, Ymin, and Ymax of a polygon. (I guess this is finding the extent of a polygon?) My current script gives me the correct the Xmin and Xmax, but it ...
2
votes
1answer
577 views

Move TEXT_ELEMENT using arcpy.mapping and data driven pages

I'm customizing an automated mapping solution using arcpy.mapping and data driven pages. Using a looping statement, I'm hardcoding the position for the mapping elements (legend, north arrow, inset ...
1
vote
0answers
271 views

using copy parallel in arcpy

I'd like to use copy parallel tool with Arcpy . i tried to access copy parallel with GUID in Arcpy but i couldn't use the property and methods of this tool . i used comtype to import Arcobjects to ...
1
vote
1answer
384 views

How to calculate field as cursor name?

First time dealing with cursor. I have lines intersecting polygons, I want to get a table with all attributes of the lines, add a field and calculate the field as the name of the polygon. I was able ...
1
vote
2answers
456 views

Python scripting for ArcPad Checkin

I can use ArcGIS Desktop model builder to leverage the ArcPad Check In Tool. When I run the model it executes successfully. When I export the model as python I get this code: import arcpy # Local ...
1
vote
1answer
436 views

How to drop ArcSDE connection using Python scripting?

I want to be able to control connections to ArcSDE via python. Here is my script so far using ESRI's example. import arcpy from arcpy import env env.workspace = r"SDEConnection" fcList = ...
1
vote
1answer
121 views

Substitute for SpatialJoin tool?

I have to write a script in Arcgis which I would like to use the SpatialJoin tool (arcpy) but I do not have the appropriate extension. It may be a tool (or example of scripts) for doing the same ...
2
votes
1answer
677 views

Convert MapInfo - MapBasic Script into Python

I have a mapbasic script that divides an irregular polygon into smaller polygons of 1 hectare each. Would anyone help me to convert the following into an arcpy python script. ' This program ...
8
votes
2answers
545 views

How to bypass errors in arcpy for/while loop?

I have a handy script tool that loops through a workspace and renames and copies shapefiles to a feature dataset. However, if there is a corrupted shapefile somewhere in the workspace the script ...
0
votes
1answer
153 views

How to populate Unique ID field after sorting?

I am trying to create an new unique id field in a feature class. I already have one field called "SITE_ID_FD", but it is historical. The format of the unique value in that field isn't what our current ...
0
votes
1answer
568 views

ArcGIS/arcpy: Can a variable be set to reference an in_memory workspace object?

This is an offshoot question related to a question I posted earlier. I have the following arcpy code that inputs a Python list of polygon geometry objects to the Union_analysis tool, which then ...
0
votes
1answer
322 views

Looping Dataframe in Python doesn't Return Expected Results

I'm creating a python addin script to be used on some mxd's I have created as templates. Each map contains 2 dataframes. I need to loop through each dataframe and do some processing on each. I set my ...