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.

The fundamental differences are as follows:

  1. The method of invoking the geoprocessor is very similar for both, with the exception of an optional parameters when creating the object.
  2. Geoprocessing methods do not return Python built-in data types but rather ESRI iterable objects.
  3. Methods that used to return True/False values now return the Python True or False object rather than a string or 0/1.

The following table illustrates the differences:

ArcGIS version 9.2 ArcGIS version 9.3
gp = arcgisscripting.create()
gp = arcgisscripting.create(9.3)
# Create a list of available feature classes
fcs = gp.ListFeatureClasses()
# Iterate through said feature classes
fcs.Reset()
fc = fcs.Next()
while fc:
    # Do work here
    fc = fcs.Next()
# Create a list of available feature classes
fcs = gp.ListFeatureClasses()
# Iterate through said feature classes
for fc in fcs:
    # Do work here
# Identify the fields of a feature class
dsc = gp.describe(fc)
# Get the fields from the description
flds = dsc.Fields
# Iterate through the fields
flds.Reset()
field = flds.Next()
while field:
    # Do work here
    field = flds.Next()
# Identify the files of a feature class
dsc = gp.describe(fc)
# Get the fields from the description
flds = dsc.Fields
# Iterate through the fields
for field in flds:
    # Do work here
# Tell the geoprocessor to overwrite output by default.
gp.OverWriteOutput = 1
# Tell the geoprocessor to overwrite output by default
gp.OverWriteOutput = True

There is not list of commands that need the changes to the best of my knowledge. But a quick look through the Geoprocessor Programming Model for ArcGIS 9.2 can show which methods return an enumeration unit. In brief, ListDatasets, ListFeatureClasses, ListRasters, ListTables, ListWorkspaces, ListEnvironments, ListToolboxes, ListTools and all other methods that return an Array Object. For a complete listing of the changes, please read the ESRI document for Geoprocessor changes in 9.3.

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading ... Loading ...

Related posts:

  1. Geoprocessing Iteration with Python
  2. Using the geoprocessor’s List* Methods
  3. Understanding the Geoprocessor Programming Model part 3
  4. Understanding the Geoprocessor Programming Model part 1
  5. Loading the Geoprocessor Safely

2 Responses to “Python Geoprocessing in ArcGIS 9.2 vs. 9.3”

  1. [...] wrong with the gp.OverWriteOutput statement, and found that there are indeed differences between ArcGIS geoprocessing 9.2 and 9.3 with this statement. But specifying 9.3 (gp = arcgisscripting.create(9.3) didn’t change [...]

  2. [...] I understand from Michalis Avraam’s page here (where I saw the above code samples) that as of version 9.3, the way to go is the Pythonic one. [...]

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2010 Michalis Avraam Suffusion theme by Sayontan Sinha