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

learn more… | top users | synonyms (1)

10
votes
1answer
3k views

Python Script to Create Table Using Data Driven Pages

I am trying to convert some python script to display a table (based on a dbf) of features located within a specific data driven page. So far, I have the script successfully able to refresh the map to ...
10
votes
2answers
749 views

Metadata -auto build using python

We have a large (10,000 plus) repository of spatial data (shp/gdb/tab vectors and ecw/tif rasters and also las, xyz and DEM data) where some have metadata records in xml using anzlic metadata editor. ...
9
votes
2answers
1k views

Why is this simple arcpy script so painfully slow?

I have a simple arcpy script to update a field in a point shapefile with info from the polygon feature that it is within. It takes 9 minutes to do 100 points in arcpy but a spatial join in arcmap is ...
9
votes
2answers
766 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 ...
9
votes
3answers
8k views

How to create a shapefile in ArcGIS 10 using arcpy?

How can I create a shapefile using Python in ArcGIS 10? I have lat & long. From this I need Python code which will create a shapefile and display it in ArcGIS 10. Thanks.
9
votes
5answers
418 views

How to improve performance when using ArcGIS cursors in Python with big tables?

I have a pretty big point feature class in a file geodatabase (~4 000 000 records). This is a regular grid of points with a 100m resolution. I need to perform a kind of generalization on this layer. ...
9
votes
2answers
4k views

How to get list of selected features in ArcGIS for Desktop using Python code?

I have a question regarding selections in ArcGIS for Desktop. Assumed I have one layer in ArcMap and I have selected two of five features. Is it possible to get a list of all selected features by ...
9
votes
6answers
427 views

How to programmatically check if the number of shapes = number of table records?

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
9
votes
2answers
2k views

Is there a ArcGIS python script development API?

I'm a somewhat experienced software engineer new to the GIS world. I started working on a GIS project that supports ArcGIS 9.3 and 10.0 and looking through existing code it looks like the main ...
9
votes
1answer
6k views

How to create a script tool that will create a copy of a feature class and offset it by a given distance? (arcpy)

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. I asked if there was any way to do this last week, and I was informed that I ...
9
votes
2answers
227 views

How to count zero values in a table in rows and write it to new field?

This is a very simple task to do but I can't understand the right syntax. I have a shapefile whose attributes are similar to the following: FID Shape FIELD1 FIELD2 FIELD3 ... 0 Polygon 0 1 ...
9
votes
2answers
8k views

Change data source path in .LYR files in Arcgis 10

How can one change the source data paths for every layer file in folder X using arcpy? I've followed Updating and fixing data sources with arcpy.mapping as best I can, yet all I get is an unhelpful ...
9
votes
1answer
4k views

“Field Mapping” in ArcGIS 10 - ArcPy

I've wrote a Python script that does a spatial join and some simple calculations. My problem is with setting the merge rule for one specific field, and leaving the rest of the fields as is. For ...
9
votes
2answers
1k views

How can I crawl directory tree and change Mxd relativePaths to true?

I have a large number of project folders where each project folder can have many subfolders. These subfolders can contain mxds, shapefiles, personal gdb's and fgdb's. In many cases the user forgot ...
9
votes
1answer
342 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. ...
9
votes
2answers
464 views

Generate near table for x number of neighbours using arcpy

There are 3 likely scenerios that I am trying to capture near distances for: An interchange subway station, which has 2 or more neighboring stations. That is, the station in question connects 2 or ...
9
votes
4answers
210 views

How to determine if point is surrounded using raster processing?

I am attempting to improve a currently extremely cumbersome vector/python process for a natural hazard model. At the moment we have a lengthy script which generates distance/bearing lines from a given ...
8
votes
4answers
2k views

How to create arcs between two points in Python?

I've been working on an python script automating the visualization of live point data. I have a table with two coordinate pairs. I'd like to connect these two point with an arc of a circle or similar ...
8
votes
4answers
266 views

Subset Folder Contents ArcPy

I have about 1500 .txt files within a folder named 3410001ne => 3809962sw. I need to subset about 470 of these files to process with a Python script. Below is the section of code prior to my for ...
8
votes
5answers
6k views

Remove feature layer using ArcPy script?

I have an ArcPy based script where I'm trying to intersect two layers where one layer must have its centroid in the other layer. Since I need to know that one layer (feature_layer below) includes ...
8
votes
2answers
2k views

How to read an Excel sheet in ArcPy script

I'm writing a python code to convert X,Y points in excel to shapefile. In this process i have toread xy points from shhet1. What is the step i have to include in my process to read data from sheet1 of ...
8
votes
2answers
309 views

Does dissolving features improve geoprocessing efficiency?

I have a large set of line data (>140,000 features). Is there a processing advantage, in either time required or (more importantly) memory used: to running Dissolve on the data before running ...
8
votes
2answers
3k views

Finding mid-point of line using ArcPy?

How can the mid-point of a polyline be calculated using the geoprocessing framework, e.g. in a Python script? The polyline.centroid property returns The true centroid if it is within or on the ...
8
votes
6answers
3k views

Get a point on a polyline from end points given distance along poly line

I have start point and end point of a polyline. How can I get a point on that polyline from end points specified by the given distance. How can I get this by using arcpy provided that this script ...
8
votes
1answer
1k views

Creating table containing all filenames (and possibly metadata) in File Geodatabase?

I need to create a metadata-table for all files in a File Geodatabase or Spatial Database. It would be awesome if it were possible to automatically be updated with new filenames, and possibly even ...
8
votes
3answers
409 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?
8
votes
2answers
851 views

ArcMap running scripts slower if you import Arcpy

I am finding ArcMap runs slower, if you have written a script, which imports arcpy. You may wish to write a script that can be operated in ArcMap, through the python window, or as a standalone ...
8
votes
1answer
509 views

Fastest methods for modifying attribute tables with Python?

A while ago, I wrote a quick Python function for converting an attribute table to a python dictionary, where the key is taken from a user-specified unique ID field (typically the OID field). ...
8
votes
2answers
2k views

How can I more efficiently select related records?

Below is the code I'm using to replicate the "related tables" button in ArcMap. In ArcMap that button selects features in one feature class or table based on the selection of features in another ...
8
votes
4answers
506 views

How to split single address field into 4 fields (House No., Direction, Name, Suffix)

I have to do some massaging of our parcel data to make it usable by a program in sheriff helicopters. The program requires one of the following address formats within the fields: Our addresses are ...
8
votes
2answers
2k views

How to reclassify a very large land cover dataset?

Consider the NLCD2001 Land Cover dataset for Alaska (download link). I need to reclassify this dataset so that only pixels of value 41, 42, and 43 are preserved; all other pixel values should become ...
8
votes
1answer
170 views

The role of '#' in a python 'if':

I recently exported an ArcGIS model to python and was reviewing the script and am confused by the following line: if TRU_W_DatableFeatures == '#' or not TRU_W_DatableFeatures: I can't seem to find ...
8
votes
4answers
975 views

How to split points by polygon?

I am looking for a way to split points by a county polygon feature class. The attached image shows two feature classes: one composed of points and the other a county polygon feature class. The split ...
8
votes
2answers
2k views

How to Rotate Features in ArcGIS for Desktop using ArcPy?

I have a series of polygons that I want to rotate. Each polygon has a rotate angle and an anchor point (xy coordinate) stored as field values. As it happens, all anchor points are on a vertex of ...
8
votes
2answers
258 views

ArcGIS 10: Create an event linear layer from a point layer based on directionality

I have a point layer that reflects the speed limits and a line layer of the roads. The location of the speed sign indicates in which direction the speed limit applies. How can I make linear event ...
8
votes
1answer
187 views

Where to find and share Python geoprocessing scripts? [duplicate]

Where are folks storing and sharing their Python geoprocessing scripts? For example, I know that GitHub has some shared scripts. ESRI is phasing-out ArcScripts, which is still really handy, and ...
8
votes
2answers
505 views

Creating summary table of symbology of all datasets in multiple MXDs?

This is related to the following Retain ESRI symbology in Mapinfo TAB . As an initial step (in arcpy) I want to access the symbology of all the datasets and create a document which has the details of ...
8
votes
2answers
349 views

How to determine storage type (ST_Geom/Oracle) from arcpy/python

We're migrating some feature classes from SDELOB (or some older binary format) to ST_Geometry. As we write our arcpy script to use the ESRI Migrate Storage Tool we'd like to test whether or not ...
8
votes
1answer
977 views

arcpy.geometry __geo_interface__ and AsShape() function: loss of precision and holes

I'm serializing my arcpy geometries as geojson so that I can 'hydrate' them back as geometries later and I'm having 2 problems in the cycle.: PROBLEM 1: Precision R0 = ...
8
votes
1answer
177 views

Difference between python window and toolbox

Are there differences in performance or other potentially critical area between running a python script in the python window versus running it from the toolbox in ArcGIS 10.0? I am asking in cases ...
8
votes
2answers
3k views

Using arcpy.SetParameter() with Python Script Tool published as Geoprocessing Service?

I have a script that needs to be published to ArcGIS Server as a geoprocessing service. This script computes a set of records in table form. I need to set an output parameter so that it returns the ...
8
votes
2answers
495 views

How to remove spikes in polygons with ArcGIS 10/Python?

In the picture below you can see a polygon layer, representing steep slopes, extracted from a TIN. The polygons have a lot of spikes in them. I would like to remove these spikes while the rest of the ...
8
votes
0answers
332 views

Two machines running the same arcpy based software - only one is leaking memory [closed]

Ok, so I'm running a rather large Python application based on arcpy on two separate machines - one of them is leaking memory and one is not. Both are running the same operation in the software. The ...
7
votes
3answers
3k views

How to delete feature class features faster (ArcPy)

I have written this script that recurses through all feature classes in a given set of feature datasets and deletes all their features. It appears to do the job but it runs pretty slowly. Is there ...
7
votes
3answers
4k views

How to include variable in where clause of arcpy.Select_analysis?

I am trying to loop through a shapefile, selecting each feature in turn and copying it to a temporary shapefile to by included in a union analysis. I'm using a cursor to find the ID name for each ...
7
votes
3answers
2k views

Python - formatting path strings and checking if a path exists

I would like to use the following code to determine if a path exists. The path I would like to check is being passed to my code via parameter on a ArcMap 10.0 tool dialog box. The parameters data ...
7
votes
2answers
1k views

How to access Esri ArcPy modules from Enthought Canopy?

I have ArcGIS 10.1 running on my windows system and I have also installed the new 32-bit Canopy Express Enthought Python Distribution. Is it possible to load and use the Esri ArcPy modules from ...
7
votes
5answers
661 views

python.multiprocessing and “FATAL ERROR (INFADI) MISSING DIRECTORY”

While trying to do multiprocessing with arcpy, I am occasionally running into this error: FATAL ERROR (INFADI) MISSING DIRECTORY I have no clue what is triggering this error, and it crashes the ...
7
votes
3answers
4k views

How do I retrieve start and end point coordinates with Python/arcpy?

How do I retrieve start and end point coordinates with Python/arcpy for a polyline feature class? I expect to pass a segment identifier to a subroutine and have it pass back start and end coordinates. ...
7
votes
4answers
5k views

Get all the points of a polyline

I have some polyline feature objects in python. Now I want to get all the points of polylines. For example, if a polyline has start point [0,0] end point [5,5]. Result: ...