Reading geometry from a feature class
There may be times when you need to retrieve the geometric definition of features in a feature class. ArcPy provides the ability to read this information through various objects.
Getting ready
In ArcPy, feature classes have associated geometry objects, including Polygon
, Polyline
, PointGeometry
, or MultiPoint
that you can access from your cursors. These objects refer to the shape
field in the table
attribute of a feature class. You can read the geometries of each feature in a feature class through these objects.
Polyline and polygon feature classes are composed of features containing multiple parts. You can use the partCount
property to return the number of parts per feature and then use getPart()
for each part in the feature to loop through each of the points and pull out the coordinate information. Point feature classes are composed of one PointGeometry
object per feature that contains the coordinate information for each point.
In this recipe, you will...