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 ...

Get Programming ArcGIS with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.