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