The geometry object |
|
|
Release 9.2
Last modified January 9, 2007 |
Print all topics in : "Data properties and access when scripting" |
Using a geometry object, the geoprocessor supports cursor access of feature geometry. The object, created by the row object when the Shape field is specified, exposes a number of properties that describe a feature. The example below shows how to create a geometry object for each line feature in a feature class and sum their length:
# Create search cursor
rows = gp.SearchCursor("D:/St_Johns/data.gdb/roads")
row = rows.Next()
# Calculate the total length of all roads
length = 0
while row:
# Create the geometry object
feat = row.shape
length = length + feat.Length
row = rows.Next()
print length
| Type | Null, point, multipoint, line, circulararc, ellipticarc, bezier3curve, path, polyline, ring, polygon, envelope, any, bag, multiPatch, triangleStrip, triangleFan, ray, sphere. |
| Extent | XMin; YMin; XMax; YMax. |
| Centroid | Returns the true centroid if it is within or on the feature, otherwise the label point is returned. |
| TrueCentroid | The center of gravity for a feature. |
| LabelPoint | The point at which the label is located. The LabelPoint is always located within or on a feature. |
| FirstPoint | The first coordinate of the feature. |
| LastPoint | The last coordinate of the feature. |
| Area | The area of a polygon. Empty for all other feature types. |
| Length | The length of the linear feature. Empty for point, multipoint feature types. |
| IsMultipart | True, if the number of parts for this geometry is more than one. |
| PartCount | The number of geometry parts for the feature. |
| HullRectangle | The coordinate pairs of the convex hull rectangle. |
| GetPart(optional index) | Returns an array of point objects for a particular part of geometry or an array containing a number of arrays, one for each part. |