Session 8, 9 and 10 - Section: Deep Representation

Geometry Hierarchies in ArcGIS

Feature Class

A feature class is a collection of one or more features.

Feature

A feature is composed of one or more parts.

Part

A part is made of one or more points.

Point

A point consists of five elements: a unique identifier (id), a coordinate pair (x, y), a vertical coordinate (z) and a measurement value (m).

Simple Geometries in ArcGIS

Single Part

Single-part Point: Point

Single-part Line: [Point, Point, Point, ...]

Single-part Polygon: [Point, Point, Point, ...]

Multiple Parts

Multi-part Point: [Point, Point, Point ...]

Multi-part Line: [ [Point, Point, Point, ...], [Point, Point, Point, ...] ]

Multi-part Polygon: [ [Point, Point, Point, ...], [Point, Point, Point, ...] ]

Multiple Ring Polygon

Single-part, Multi-Ring Polygon: [ [Point, Point, Point, ...], , [Point, Point, Point, ...] ]

Multi-part, Multi-Ring Polygon: [ [ [Point, Point, Point, ...], , [Point, Point, Point, ...] ], [ [Point, Point, Point, ...], , [Point, Point, Point, ...] ] ]

Accessing Geometries

The CreateObject() Method

All communication between your Python program and ESRI's geometries is done through the Geoprocessor objects. There are multiple objects available, including Point, Array, Geometry, SpatialReference, etc. These serve the purpose of translating between Python code and ESRI's code. When reading, writing or updating geometries, you NEED to use these predefined objects.

For example:

pnt = gp.CreateObject("Point")

array = gp.CreateObject("Array")

etc...

Reading/Writing/Updating Feature Geometries

To reach the geometry of any object, you need to create a cursor to the object. A cursor can be though of a pointer to a specific row in your file that provides some added functionality.

There are 3 cursors available with the Geoprocessor: SearchCursor, InsertCursor and UpdateCursor. The SearchCursor allows you only to read rows in a feature class. The InsertCursor allows you to only add new rows. The UpdateCursor provides you the ability to either change a specific row, or completely delete it.

For example:

mySearchCursor = gp.SearchCursor("location_of_file")

myInsertCursor = gp.InsertCursor("location_of_file")

myUpdateCursor = gp.UpdateCursor("location_of_file")

When running any of the methods the cursors make available to you, you receive back a Row, which has a FieldName property and a GetValue() method. If it is the UpdateCursor or the InsertCursor, you also have access to the SetValue() method.