[mapguide-users] postgis fdo-ogr and spatial indexes

Frank Warmerdam warmerdam at pobox.com
Wed Jun 13 18:10:35 EDT 2007


alucas wrote:
> Hello,
> 
> I'm testing the ogr provider with postgis and it works fine, I connect vía
> Map 2008 and MGOS 1.2. So, the question is about the spatial indexes (gist).
> How works the ogr provider with gist indexes? I'm attempting to get better
> performance with this configuration.

"alucas",

GDAL/OGR 1.4 uses the following construct when building a
query against a postgis table to apply a spatial filter.

     m_poFilterGeom->getEnvelope( &sEnvelope );
         osWHERE.Printf("WHERE %s && SetSRID('BOX3D(%.12f %.12f, %.12f 
%.12f)'::box3d,%d) ",
                        pszGeomColumn,
                        sEnvelope.MinX, sEnvelope.MinY,
                        sEnvelope.MaxX, sEnvelope.MaxY,
                        nSRSId );

This is intended to use the spatial index and normally works as
far as I know.  If you run MgServer from the commandline, and
enable CPL_DEBUG (set this enviroment variable to ON) you should
see debug output from the OGR provider indicating the specific query
it ends up using.  It should be prefixed with something like:

   OGRPGTableLayer::BuildWhere returns:

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 mapguide-users mailing list