GEOG 485:
GIS Programming and Software Development

Error message

Notice: unserialize(): Error at offset 14 of 14 bytes in variable_initialize() (line 1202 of /net/www/

Lesson 1 Practice Exercise 4



import arcpy

fc = "C:/Data/USA/USA.gdb/StateBoundaries"

desc = arcpy.Describe(fc)
shapeType = desc.shapeType

print ("The geometry type of " + fc + " is " + shapeType)


This script begins like the one in example 1.6.2 since both require using the Describe method. As mentioned in the exercise instructions, you can see that the Describe method provides access to a spatialReference property by looking at the Describe method's help page for Datasets. In other words, if the object you're describing is a type of Dataset, it has a spatialReference property.

In this case, you were asked to determine the geometry type of a feature class and given the hint that the property you need belongs to objects of the type FeatureClass. This hint should have led you to click the FeatureClass link on the Describe method's Help page and scan through the list of properties until you found shapeType. The solution above reads the shapeType property, stores the return value in a variable, and then inserts that value into a user-friendly print message that also includes the name of the feature class.