[gdal-dev] [python-ogr] GetNumPoints from geometry

Paolo Corti pcorti at gmail.com
Wed Feb 9 09:55:27 EST 2011


>
> There are OGR_G_GetPointCount in ogr_api.h and GetPointCount method in the
> Geometry class in Swig bindings.
>

Right, I was also trying to figure out this, this is my test code:

lineshp = driver.Open('/home/pcorti/data/shapefile/line.shp')
linelyr = lineshp.GetLayer(0)
feat = linelyr.GetNextFeature()
geom = feat.GetGeometryRef()
print geom.GetGeometryName()
LINESTRING
print geom.GetPointCount()
8

This is also suggested on the doc [0]

best regards
P

[0] http://www.gdal.org/ogr/classOGRLineString.html#7ea70605cd6ac71221177586c2ec5cfc

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @paolo_corti


More information about the gdal-dev mailing list