Using Describe
Topics How to use describe? Retrieving Descriptive Information about data
Describe( ) Function Describe function returns a describe object containing a set of properties Depending on what data type is being described, different describe properties will be available for use.
Describe( ) Function Describe on a FeatureClass returns a set of FeatureClass properties along with access to Table Properties and Dataset Properties That is using Describe() against a feature class not only provide access to a FeatureClass property group, but also a Table property group and a Dataset property group.
Describe( ) Property Group Can explore each of them from ArcGIS online help!
FeatureClass Properties Commonly used FeatureClass properties – featureType Simple, Annotation, etc –shape Type Point, Polyline, Polygon, etc
FeatureClass properties example import arcpy des = arcpy.Describe(“Auburn.gdb\\Parcel”) print “Feature Type: “ + des.featureType # returns Feature Type: Simple print “Shape Type: “ + des.shapeType # returns Shape Type: Polygon
Table Properties This group contains a very useful propery – fields
Field Object Each field has a number of properties The most common ones are -- name and -- type
Field properties example import arcpy des = arcpy.Describe(“C:\\Data.gdb\\Parcel”) test = des.fields for field in test: print field.name print field.aliasName print field.type # returns LandUse Use String
Dataset Properties The dataset property group contains a number of useful properties Commonly used properties are: - spatialReference - extent etc.
Dataset Properties Example import arcpy file = "C:\\temp\\Data\\Schools.shp” des = arcpy.Describe(file) print des.spatialreference.name xyExtent= des.extent print "Xmin: ", xyExtent.XMin print "Xmax: ", xyExtent.XMax print "Ymin: ", xyExtent.YMin print "Ymax: ", xyExtent.YMax Xmin: Xmax: Ymin: Ymax: # returns: #Returns: NAD_1983_StatePlane_Texas_Central_FIPS_4203_Feet
Let’s try it!