Obtaining Descriptive Information About GIS Datasets with ArcGIS Geoprocessing Objects (Part 4)

Posted on February 17, 2008. Filed under: ESRI, Geoprocessing | Tags: , , , |

Other posts in this series: 
Scripting Your ArcGIS Geoprocessing Tasks (Part 1)
Scripting Your ArcGIS Geoprocessing Tasks with Cursors (Part 2)
More ArcGIS Geoprocessing Concepts – Enumeration Objects (Part 3)

The arcgisscripting/GpDispatch object contains a Describe method that can be used to return an object that describes data.  The Describe method takes a single argument which is a pointer to a data source.  This method is intelligent enough to determine the type of data being referenced and return an object that describes the type of data.   Each descriptive object returned contains information about the particular dataset specified in the InputValue parameter passed into the Describe method.


For instance, if you use the Describe method with a  pointer to a feature class, a FeatureClass Properties object will be returned containing information about that dataset.  This object is often used to test for the type of data (either point, line, or polygon) before further processing.  Various read-only properties are available through this object including ShapeType which returns the basic data type such as point, line, or polygon, FeatureType, ShapeFieldName, and others. 

 This class also has access to two other classes in the Describe object model diagram.  These two classes are Table Properties and Dataset Properties.  The Table Properties object supplies a Fields object containing the Fields in the feature class as well as an Indexes property that returns an Indexes object containing all indexes on the feature class.    The Dataset Properties object contains properties for the spatial reference, extent, and dataset type.

Other Describe Objects
There are a number of other describe objects that can be returned by the Describe method including Tables, Datasets, Workspaces, Relationships, Raster Catalog, Raster Dataset, Raster Band, Coverages, and Layers.  For specific information about these objects please see the green colored objects on the OMD.

Common Describe Object Properties 
All objects returned by the Describe method on GpDispatch can access two additional properties.  These properties are DataType and CatalogPath.  DataType is used to distinguish between types of features classes such as shapefiles, coverages, personal geodatabases, CAD data, and others.  It is often used in if..elif..else decision statements to branch code based on the type of data.  CatalogPath can be used to obtain the full path to the data based on an ArcCatalog connection.  This information is identical to what you would find if you were viewing the data in ArcCatalog.

More Information
We will be presenting a new Virtual GIS Classroom course, “GIS Programming 101: Mastering Python for Geoprocessing in ArcGIS” starting March 24th and ending April 18th.  We still have 5 seats of available so hurry to reserve your seat now.  We do offer a 15% discount for government, educational, and non-profit entities.

We also offer an e-learning course entitled “Introduction to Geoprocessing with Python” which contains even more detailed information on ArcGIS geoprocessing with approximately 200 slides of audio and video lectures, visual software demonstrations, exercises and data.


Make a Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: