[Gdal-dev] spatial intersection of ogr geometry and shapefile
features
Frank Warmerdam
warmerdam at pobox.com
Wed Jun 6 15:24:45 EDT 2007
Martel, Christian wrote:
> Frank,
>
> Thanks. This is the hint I was looking for.
>
> I read in the doc about SetSpatialFilter:
> "Currently this test is may be inaccurately implemented, but it is
> guaranteed that all features who's envelope (as returned by
> OGRGeometry::getEnvelope()) overlaps the envelope of the spatial filter
> will be returned. This can result in more shapes being returned that
> should strictly be the case."
>
> It's ok because I only want a bbox comparison. Do you plan to update the
> function to do an intersection test with the actual geometry ? If so I
> should try something else to ensure my code will always return the same
> result.
Christian,
In fact, right now if you build with GEOS support enabled for OGR and you
use a non-rectangular geometry with SetSpatialFilter() I believe it does
an exact test for most drivers. Some drivers (such as RDBMS drivers)
implement the spatial test themselves and may only use bounding boxes.
If you very specifically only want a bounding box comparison, then you
should use a rectangular envelope for your target region, rather than an
irregular shape.
Best regards,
--
---------------------------------------+--------------------------------------
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 | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list