Feb 25

Often times people write geoprocessing scripts that others try to incorporate in their work. This is done through modules or packages in Python. This is wonderful when one wishes to share their work, but it can also be bothersome if the module you are loading assumes that there is no geoprocessor loaded. This little script will help you safely load the geoprocessor object, either from an instantiation by the main program, or from scratch.

Continue reading »

Tagged with:
Feb 03

After a long delay, it is time for the third installment of understanding the Geoprocessor Programming Model that will deal with the Describe object. If you missed the last two parts, feel free to look at them first (Part 1: understanding what the geoprocessor is, and Part 2: accessing data with the geoprocessor). As always, comments are welcomed and encouraged. Continue reading »

Tagged with:
Oct 19

In the first part of this series I covered access to the geoprocessor and how one can navigate the first part of the diagram of the model. If you are not familiar with the geoprocessor, please have a quick look at that post to understand the geoprocessing model ESRI provides.

In this post I will finish covering the bottom left part of the model that deals with direct access to features and their geometry. In order to do that, we will discuss cursors, features and geometries.

Continue reading »

Tagged with:
Oct 16

ESRI's Geoprocessing Prorgamming Model

A question often asked when people venture into the wonderful world of Python Geoprocessing with ESRI is how one can read the programming model they make available on their website. As it may not be easily interpreted when one begins programming, I will do my best to unpack it and explain how one can use it more effectively. All images presented here are extracts from the actual model presented by ESRI on their website.

Continue reading »

Tagged with:
Aug 19

The geoprocessor object has multiple List methods one can use to retrieve lists of items that it is aware of. Below are examples of the most commonly encountered ones: ListWorkspaces(), ListTables(), ListRasters(), ListFeatureClasses(), ListDatasets() and ListFields().
Continue reading »

Tagged with:
Jul 16

There are some fundamental differences between geoprocessing performed in ArcGIS version 9.2 and 9.3. While I will not cover them all in this post, I will attempt to show the most fundamental differences that people seem to encounter more often.
Continue reading »

Tagged with:
Jun 17

Writing Excel files using Python is quite easy, using the xlwt package. Similar to xlrd mentioned in an earlier post, xlwt allows one to write Excel files from scratch using Python. Continue reading »

Tagged with:
Jun 15

It is often the case that the freely available data online are in Excel format. If one has Excel, then one has the ability to do some sort of basic manipulation of the files. But if Excel is not available, or your analysis software does not read Excel files, there is another way: use Python to manipulate Excel files. Continue reading »

Tagged with:
Jun 11

There are multiple problems analysts face when they have to deal with processing multiple data files. There is the issue of identifying similarities and commonalities in files, and then of course how to automate the processing so they don’t have to run a program multiple times with the same parameters of separate files. In the world of ESRI’s GIS analysis, this can be performed quite easily with the help of Geoprocessing, either in Python or the Model Builder. Below is sample code that allows the iteration over a number of datasets. Continue reading »

Tagged with:
Jun 04

In the many methods present at the Python interface to ArcGIS (Python geoprocessing through the arcgisscripting module), one that is quite useful when processing individual elements on a feature class is called MakeFeaturelayer(). The behavior, while predictable with a small number of runs, can prove problematic when dealing with large datasets. Continue reading »

Tagged with:
preload preload preload