[gdal-dev] Accuracy of OGRLayer:SetSpatialFilter() API

kedardeshpande87 kedardeshpande87 at gmail.com
Tue Jun 12 10:44:15 PDT 2012


Frank,

Thank you very much for the reply.

I am still really curious about what could be the reason that it returns
multiple features for a single point.
The code for filtering which I have written is like this : 
...
OGRDataSource *ds = OGRSFDriverRegistrar::Open("shapefile_path", FALSE);
OGRLayer *layer = ds->GetLayer(0);
OGRGeometry *g = new OGRPoint(longitude, latitude);
layer->SetSpatialFilter(g);
OGRFeature *feature = NULL;

while((feature = layer->GetNextFeature()) != NULL) {
       // do something with feature ...
}

As per the API doc, it says : "it is guaranteed that all features who's
envelope (as returned by OGRGeometry::getEnvelope()) overlaps the envelope
of the spatial filter will be returned."

I checked the envelope the OGRPoint geometry I have created. This envelope
is also a single point (minX, maxX are same and minY, maxY are same). So,
how is it possible that multiple features overlap on the same point ?  

For the same shapefile, I checked results by using some other libraries as
well. Those libraries return a single zipcode. So I am guessing the
shapefile which I am using does not have overlapping data.

Could it be that the vector math done while calculating the intersection of
filter-geometry and features has some limitations?
Could you please give me some idea about this ?

Thanks,
Kedar

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-Accuracy-of-OGRLayer-SetSpatialFilter-API-tp4980063p4980907.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list