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

Frank Warmerdam warmerdam at pobox.com
Fri Jun 8 13:18:30 PDT 2012


Kedar,

If you build GDAL/OGR without use of the GEOS library then I believe
the spatial filtering is normally just based on bounding boxes.  So
you are likely getting back all the zip codes which have a bounding
box including the target point.

The SetSpatialFilter() method should have documentation suggesting in
some scenarios it may produce more features than strictly satisfy the
spatial filter.

If you rebuild with GEOS you will hopefully get an exact spatial
filtering.  Some caveats might apply for points on zip code
boundaries.

Of course it is also possible there is some overlap in your zip code
polygon set.  One thing I'm learning in my current job is that
datasets are rarely clean. :-)

Best regards,
Frank

On Fri, Jun 8, 2012 at 12:59 PM, Kedar Deshpande
<kedardeshpande87 at gmail.com> wrote:
>> Hi,
>>
>> I am creating an application that reads a shapefile having Zipcode
>> Tabulation Area information (provided by US Census Bureau).
>> Once I get the layer, I am setting a spatial filter on it. I am passing a
>> OGRPoint object to it having some values for latitude and longitude.
>> After I apply this filter, I am iterating over the Features that the layer
>> returns.
>> But for a given geometry point, it is returning more than one features. I
>> am extracting the zipcode from the feature.
>> So, it is returning me more than one zip codes for one lat/long point.
>> Could someone please let me know why is this behavior observed ?
>> If it returns multiple features for a filter, what is the order in which
>> it returns the features (when we call layer->GetNextFeature()).
>> Is this order according to how exactly the filter matches Or is it not
>> definite ? The documentation in the API does not mention about the order.
>>
>> Thanks,
>> Kedar
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer


More information about the gdal-dev mailing list