[gdal-dev] Layer.GetNextFeature() does not seem to get the next feature (Python 2.7.2, GDAL1.9.2

David Verbyla dlverbyla at alaska.edu
Thu Dec 20 20:36:09 PST 2012


I have a layer of 15 polygons from a shapefile.  I can access the features
using Layer.GetFeature(i),
but not using Layer.GetNextFeature().

For example:
>>> polyFeature = pondsLayer.GetFeature(0)
>>> print polyFeature.GetFID()
0
>>> polyFeature = pondsLayer.GetFeature(1)
>>> print polyFeature.GetFID()
1

>>> polyFeature = pondsLayer.GetFeature(0)
>>> print polyFeature.GetFID()
0
>>> polyFeature = pondsLayer.GetNextFeature()
>>> print polyFeature.GetFID()
Traceback (most recent call last):
  File "<pyshell#23>", line 1, in <module>
    print polyFeature.GetFID()
AttributeError: 'NoneType' object has no attribute 'GetFID'

Any suggestions?

Thanks.

Dave Verbyla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121220/4931c72c/attachment.html>


More information about the gdal-dev mailing list