Thursday, May 12, 2011

Describing Data

Since you can work with all types of data geoprocessing, sometimes you want to know some additional information about the dataset than just its path.  The describe function is the tool you should use to examine dataset's properties.  For example, say you want to know what type of geometry a shapefile is:

Example: Determine Shape Type

fc = r"c:\temp\myshape.shp
desc = arcpy.Describe(fc)
print desc.shapeType

This block of code will output a string telling the end user the type of geometry used for this shapefile.

In general, the Describe function returns a Describe object. The output of Describe contains various properties, such as data type, fields, indexes, etc... The objects properties are dynamic which means that the data type will determine what properties are returned.

All Describe object will have the same base properties:

Common Describe Properties
 After that, the properties vary depending on data type and it is recommended that developers read up on the various data type properties found here.

Enjoy