Le vendredi 21 décembre 2012 05:36:09, David Verbyla a écrit :
> 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?

Note that the feature retrieved by GetNextFeature() isn't influenced by 
previous calls to GetFeature(), but just by previous calls to 
GetNextFeature(), ResetReading(), SetNextByIndex(), and sometimes 
GetFeatureCount().
Perhaps you have installed a spatial and/or attribute filters that would result 
in an empty answer ?

> 
> Thanks.
> 
> Dave Verbyla
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to