[gdal-dev] OGR and database filter on spatial extent

Frank Warmerdam warmerdam at pobox.com
Tue Jun 9 11:42:40 EDT 2009


Brent Fraser wrote:
> Hi All,
> 
>  In the case of accessing data in a relational database, does OGR have 
> the ability to pass a spatial extent to the database to use as a filter 
> on the geometry before sending the rows?

Brent,

Yes.  The OGRLayer has a SetSpatialFilter() method for this.  Some drivers
evaluate the spatial filter in OGR after reading all records, but smart
drivers are able to use the spatial filter for efficient querying.  So, the
spatially enabled databases work it into the query.

The -spat switch for ogrinfo is translated into a SetSpatialFilter() call
for instance.

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    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list