[gdal-dev] Upgrading Version Not Working

Even Rouault even.rouault at mines-paris.org
Thu Jul 24 13:03:58 PDT 2014


Le jeudi 24 juillet 2014 21:49:19, Nelson, Nicole a écrit :
> Hello,
>    I am working on an application which was developed by another developer
> about 2 years ago. At the time the developer used GDAL 1.9.1. I am trying
> to upgrade to the latest version of GDAL (1.11.0). However, I am not able
> to get the same functionality to work. I am reading in a shape file with
> ogr.Open which is successful. Then I am able to get a layer successfully.
> On that layer I try to apply a spatial filter with a single point geometry
> representing a latitude and longitude pair. However, when I call
> GetNextFeature I always get null, regardless of the input. The
> GetNextFeature function previously returned at least one feature. Did
> something change in the versions that I may have missed?

Nicole,

Single point spatial filter must be an odd use case. Not sure this is present 
in our regression tests, so that might have been accidentaly broken. However I 
just made an experiment with GDAL trunk :

$ cat square.csv
id,WKT
1,"POLYGON((0 0,0 1,1 1,1 0,0 0))"

$ ogr2ogr square.shp square.csv


$ ogrinfo square.shp -al -spat 0.25 0.5 0.25 0.5
INFO: Open of `square.shp'
      using driver `ESRI Shapefile' successful.

Layer name: square
Geometry: Polygon
Feature Count: 1
Extent: (0.000000, 0.000000) - (1.000000, 1.000000)
Layer SRS WKT:
(unknown)
id: String (80.0)
WKT: String (80.0)
OGRFeature(square):0
  id (String) = 1
  WKT (String) = POLYGON((0 0,0 1,1 1,1 0,0 0))
  POLYGON ((0 0,0 1,1 1,1 0,0 0))

So at least on that example it seems to work.

> Is there
> something that would make GetNextFeature return null, but GetFeature at
> various indices return values?

Yes, GetFeature() doesn't take into account the spatial filter.

Best regards,

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list