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

learn more… | top users | synonyms (1)

68
votes
5answers
11k views

Accessing ArcObjects from Python?

I would like to be able to script some things that are not exposed via arcgisscripting or ArcPy. How do I access ArcObjects from Python? I'm working with ArcGIS Desktop 9.3.1 right now, but will be ...
45
votes
6answers
3k views

When to use ModelBuilder over Python scripting and vice versa?

I am new to Python scripting in ArcGIS but not new to ModelBuilder. I would like to know the benefits of Python vs ModelBuilder. When should we write Python script for GIS automation rather than ...
43
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 ...
34
votes
7answers
5k views

How can I effectively debug arcpy Python scripts?

I have written many Python scripts using arcpy in ArcGIS 10, and so far my only means of debugging is restricted to printing messages to the geoprocessing results window using arcpy.AddMessage(). Are ...
29
votes
3answers
1k views

How to Share Open Source Python Code for ArcGIS?

My company just purchased ArcGIS software. I'll be writing scripts for ArcGIS in Python. Is there a community or open source project where this code can be shared?
28
votes
2answers
1k views

Streamlining Python Code for Big Data

I have Python code which is designed to take point shapefiles through the following workflow: Merge points Integrate points, such that any points within 1 m of each other become one point Create ...
27
votes
4answers
3k views

Performance of ArcGISScripting and large spatial data sets

I am currently writing a python script using the arcgisscripting module to process a reasonably large data set (~10,000 records in total) normalised over a small number of tables, 8 in total. The ...
26
votes
9answers
4k views

What are some resources for learning ArcPy?

I would like to learn ArcPy, but I do not know quite where to begin. Does anyone have any good advice on where I should start to learn ArcPy?
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 ...
18
votes
7answers
2k views

Is there a way to code-complete arcpy scripts using an external editor?

I have been scripting in Python for ArcGIS 10, and so far I have just been using Notepad++. I like how the Python command line interface code-completes arcpy functionality for you, showing you your ...
18
votes
4answers
1k views

Run a Python Script when opening an MXD?

Can anyone tell me how to accomplish this? I want a Python script to run on opening the MXD which would pull an excel worksheet into a GDB and refresh the map. I only want this to happen in this ...
18
votes
1answer
1k views

ArcGIS 10.1 Python AddIn Using Multiprocessing crashes ArcMap?

I would like to run a multiprocessing task from a python add-in tool. My issue is that the process keeps failing. Basically crashes ArcMap. Here is my basic code: def function(startOID, endOID, ...
17
votes
6answers
6k views

Ways to Speed Up Python Scripts Running As ArcGIS Tools

This is a pretty general question. I just wondering what tips and tricks GIS programmers have used to speed up arcpy scripts that you import into the toolbox and run. I work most everyday writing ...
17
votes
3answers
10k views

ArcPy and running Python scripts (with parameters) within another Python script

A common coding pattern used in AML was to run an AML (with parameters) inside another AML. An application that I'm currently developing would benefit from being able to run a Python script (with ...
16
votes
4answers
891 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 ...
16
votes
5answers
593 views

How to buffer raster pixels by their values?

The pixels to the left represent tree locations and their associated crown radii (i.e. pixel values ranging from 2 - 5). I would like to buffer these raster pixels by their crown radius value. The ...
15
votes
5answers
1k 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 ...
15
votes
2answers
2k views

Exporting table to XYZ ASCII file via ArcPy?

I'm looking for a way to export an ArcGIS table (created with the Sample tool) to a text file via ArcPy. I can do this in ArcGIS via the context menu by right-clicking the table, but have not found ...
14
votes
3answers
2k views

Do ArcGIS SpatialReference object factory codes correspond with EPSG numbers?

I've got a project where I'm reading in geometry objects from text files to put them in ArcSDE. These geometry objects have an associated EPSG code, and I'm looking for a way to ensure they're in the ...
14
votes
3answers
7k views

Listing all feature classes in File Geodatabase, including within feature datasets?

From python how can I build a list of all feature classes in a file geodatabase (*.gdb), including inside feature datasets? The standard example only lists feature classes at the top level of the ...
14
votes
2answers
1k views

Calling arcpy/python from .NET?

Are there any available examples that show how python can be integrated into a .NET ArcGIS Addin or Extension? I have a series of python scripts that I would like to call from form events (e.g. button ...
14
votes
3answers
2k views

Can i use ArcPy to get layer symbology?

Hello all Since ArcGIS 10 comes with ArcPy package, i'm wondering it is possible to use ArcPy functions to get Symbology (i.e color, width...) of a layer? Thanks in advance
13
votes
4answers
8k views

Is it possible to use Arcpy in ArcGIS 10 to zoom to a selected feature?

The answer to this may be a simple yes or no, but I'm hoping that someone is aware of a way to zoom to the extent of a selected feature using the ArcPy modules in ArcGIS 10.
13
votes
2answers
2k views

How to smooth/interpolate a raster in python using GDAL?

This is my first post so please feel free to critique where necessary. Background: I am developing in Python and using GDAL from OSGEO to manipulate and interact with rasters and shapefiles. ...
13
votes
2answers
279 views

File organization for sharing ArcGIS python code

What is the best organizational structure for sharing ArcGIS python code and geoprocessing tools? Or even, are sharing code and sharing tools separate questions? Esri has a Methods for distributing ...
13
votes
1answer
296 views

Watermarking photos using their geotag and create a shapefile

I have geotagged photographs and I would like to place a watermark of the photos location on the front for easy reference as well as creating a shapefile from the coordinates. Does anyone know of any ...
13
votes
1answer
2k views

How do you write a Python script for repairing data sources in ArcGIS 10

So, I have about 50 mxd's with all broken layers that I have been going through and manually resetting. The data was moved from another computer and the folder structure was changed so it isn't just ...
13
votes
2answers
2k views

Add a new group layer with python ArcGIS 10

Does anyone now how to add a group layer with python can I use arcpy.mapping.AddLayer but surely this is only for an actual layer as opposed to a group layer. so far I have this import arcpy mxd = ...
13
votes
1answer
748 views

How can I utilize NumPy arrays to optimize big data geoprocessing?

I'm interested in learning how to utilize NumPy arrays to optimize geoprocessing. Much of my work involves "big data", where geoprocessing often takes days to accomplish certain tasks. Needless to ...
12
votes
3answers
8k views

Will ArcGIS 10 support Python 2.7 or Python 3.1?

I'm curious to know whether ArcGIS 10 will support newer versions of Python than 2.6. And for that matter newer versions of NumPy (ie, 1.4, 1.5 etc). I'm sure that this documentation is on the ESRI ...
12
votes
3answers
627 views

Industry-based examples of using Python in geoprocessing and arcpy

I was asked recently by some students what types of operations GIS Analyst/Developer are usually trying to automate by using Python with geoprocessing in ArcGIS and ArcPy site package. I guess it ...
12
votes
2answers
309 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 ...
12
votes
4answers
1k views

How can one compare two geometries in arcpy successfully?

I am trying to compare two separate feature classes to identify differences between them (sort of a diff function). My basic workflow: I extract the geometries using a SearchCursor Save the ...
12
votes
1answer
1k views

How to get size of file geodatabase feature class on disk?

Is there a simple way to determine the amount of hard drive space a feature class takes up? I feel like I'm missing something simple, but I don't recall a method that does so. You would think that ...
12
votes
3answers
2k views

How do I use sys.exit(0) in an arcpy script to exit early without having an error message show up?

I have an arcpy tool script for ArcGIS 10.0 that has two major functional sections. The user can choose whether or not to run the second section. If the user chooses NOT to run the second section, I ...
12
votes
2answers
311 views

Arcpy adds erroneous interior ring when writing adjacent, multipart geometry

I've run into an odd issue when using Arcpy to write multipart geometry to a shapefile. I am using an InserCursor to create a multipart feature from a list of parts each with a list of vertex pairs. I ...
11
votes
3answers
4k views

What is the proper syntax and usage for ArcGIS “in_memory” workspace?

I am unclear how best to use the in_memory workspace in ArcGIS. The best resource I have found on the subject is from ESRI on Using in-memory workspace. Unfortunately, the help section is not very ...
11
votes
1answer
2k views

Fastest way to count the number of features in a feature class?

With the introduction of the Data Access module in arcpy (30x faster search cursors), I want to know if counting features matching sql criteria is faster than the traditional MakeTableView + GetCount ...
11
votes
4answers
4k views

How to manually break statement execution in python console of ArcMap

How does one break the execution of a long-running process in the python console of ArcMap? For example, how do you break a long iteration like the one below once it is started? for i in range(1, ...
11
votes
1answer
346 views

File Validation using ArcPy

I have a script which scans a directory and outputs basic raster data information such as the file name, format, number of bands, and etc. I need a way to make it so if the directory does not contain ...
11
votes
1answer
885 views

How can I display raised error messages to the user in the ArcGIS geoprocessing results window?

Question: Can print statemnts raised from a custom exception be displayed in the gp results window? Background: I modified a script that I found that takes two inputs from a user, finds the ...
11
votes
1answer
430 views

Teaching Python to Land Surveyors

Does anyone have any good examples of using Python to automate or simplify common surveying tasks? I'm teaching a Python/ArcPy lab this week for a GIS class. There are a number of surveying ...
10
votes
2answers
540 views

Is there a compelling case to learn/use Python Toolboxes (new at ArcGIS 10.1) over Python Script Tools?

I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox. I thought the Online ...
10
votes
2answers
1k views

Methods for optimizing multcore processing in ArcGIS

I am interested in learning methods to utilize the full extent of multicore processing power available on a desktop computer. Arc states that background geoprocessing allows the user to utilize ...
10
votes
2answers
2k views

How do you delete an in-memory Table View?

In a Python script, I'm cycling through thousands of Excel files and using arcpy.MakeTableView to create in memory table views from the first spreadhseet in each file. How do you delete the reference ...
10
votes
2answers
245 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?
10
votes
2answers
4k 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 ...
10
votes
3answers
975 views

Efficiently finding the 1st order neighbors of 200k polygons

For every one of the 208,781 Census block groups, I'd like to retrieve the FIPS IDs of all of its 1st order neighbors. I have all the TIGER boundaries downloaded and merged into a single 1GB ...
10
votes
4answers
2k views

ArcGIS 10.0 Python SearchCursor file locking

I have a script that gets a value from a shapefile's field to return to the user. It seems that only when the arcpy.SearchCursor is called ArcMap locks the file and it doesn't get removed after the ...
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 ...