Hi,
I just started using ogr a couple of weeks ago, as I move away from arcpy.
After some head scratching, I came up with the following code to get a
vertex count for a polygon shapefile:
numVertices = 0
dataSource = driver.Open(shp, 0)
layer = dataSource.GetLayer()
for feature in layer:
geom = feature.GetGeometryRef()
for polygon in geom:
numVertices += polygon.GetPointCount()
The script works, but returns a different count from the script I have used
in the past with arcpy (pasted below)
numVertices = 0
desc = arcpy.Describe(shp)
shapefieldname = desc.ShapeFieldName
rows = arcpy.SearchCursor(shp)
for row in rows:
feat = row.getValue(shapefieldname)
numVertices += feat.pointCount
Any help would be awesome!
Thanks!
Cody
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev