[gdal-dev] Spatial Filters and PostGIS

Even Rouault even.rouault at mines-paris.org
Thu Feb 11 14:50:32 EST 2010


Le Thursday 11 February 2010 19:53:41 Frank Warmerdam, vous avez écrit :

Craig,

Since GDAL 1.6.0, spatial filtering on layers returned by ExecuteSQL() should 
be rather fast (http://trac.osgeo.org/gdal/changeset/14291). I see a 
OGRPGResultLayer::SetSpatialFilter() method that appends an intersection test 
to the SQL request, similarly to what is done in OGRPGTableLayer. This is 
only true if the code was able to determine the SRID of the geometry column 
returned by your SQL request. Maybe your request is too complex for that ?

Best regards,

Even

> Miller, Craig wrote:
> > I was browsing the PostGIS  driver code today and noticed that when used
> > with ExecuteSQL the spatial filters appear to be getting applied on the
> > client side instead of the PostGIS side.  Am I understanding the code
> > correctly?
>
> Craig,
>
> Yes, that is correct.  When using ExecuteSQL() we pass on the SQL
> directly without alternation which means we need to do the spatial
> query manually after the fact.
>
> On the other hand, when you access postgres/postgis through a normal
> OGRLayer, we do attempt to incorporate the spatial and attribute filters
> into the internally generated SQL used to read the features.
>
> Best regards,




More information about the gdal-dev mailing list