Frank,
Interesting. I'm attempting to use Mapserver -> OGR -> VRT -> ODBC ->
SqlServer2000 -> a table of 250k rows of point features.
Testing with ogrinfo to return all the rows takes about 25 seconds, but with a
"-spat" to get about 3000 rows takes < 2 seconds (very acceptable). And I
didn't need to create a view with XMIN,YMIN,XMAX,YMAX as implied on GDAL's ODBC format page;
OGR applied the filter to the point coordinate columns (dunno what it would do with lines or
polygons and no min/max columns though).
Looking at mapserver's mapogr.cpp, it appears that OGR_L_SetSpatialFilter is
being called, so I'll have to do some more tracing/debugging to find out why my
mapserver performance is so bad with this layer.
Thanks!
Brent Fraser
Frank Warmerdam wrote:
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,
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev