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

learn more… | top users | synonyms (1)

9
votes
5answers
373 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
3k 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
389 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
224 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
3k views

How to export only certain columns to a CSV file in ArcGIS?

I've written a python script using arcpy which outputs a polygon feature class into a File Geodatabase. I have added a function to export the attributes to a separate CSV file. I am using the code ...
9
votes
3answers
3k views

What is quickest way to select polygon by point in ArcGIS 10 using ArcPy?

I keep thinking that I must be missing something, but there does not seem to be a tool in ArcGIS 10 to select features (in particular polygons) from a layer at a point (X,Y) location via ArcPy. The ...
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
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
1answer
321 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
432 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
189 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 ...
9
votes
1answer
2k 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 ...
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
253 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
653 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 ...
8
votes
2answers
2k 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
3answers
368 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
817 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
2answers
225 views

How is the data access cursor performance so enhanced compared to previous versions?

The data access module was introduced with ArcGIS version 10.1. ESRI describes the data access module as follows (source): The data access module, arcpy.da, is a Python module for working with ...
8
votes
1answer
461 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
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
167 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
880 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
242 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
179 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
483 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
325 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
925 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
165 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
2k 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
437 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
328 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
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 ...
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
5answers
624 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
3k 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
4k 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: ...
7
votes
3answers
357 views

can arcpy detect whether it's running in Desktop or Server?

I'm developing some code that I want to run both as an ArcGIS Server web service and as a standalone script. I want to be able to modify the execution slightly depending on whether it's running as an ...
7
votes
4answers
315 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 ...
7
votes
2answers
198 views

Finding specific pixel values ​​in ArcGIS using Python

I have a raster file containing some integer values. I need to find all pixels whose values are not defined in list like this one: l = [1,2,4,8,16,32,64,128]. Is there any easy way to solve that ...
7
votes
2answers
395 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 ...
7
votes
1answer
1k views

How to perform a table look-up using Python in ArcGIS 10.0?

Using ArcGIS 10.1 the arcpy module has a TableToNumPyArray command, which converts a table into an array. Unfortunately I don't have access to 10.1 on my work PC. Is there a workaround which will ...