[Gdal-dev] Re: OGR Shape file Index usage

Frank Warmerdam warmerdam at pobox.com
Thu Dec 30 10:21:44 EST 2004


Sheykhet, Rostic wrote:
> Hi All,
> 
> I am trying to use OGR to access a rather large (~90M) shape file with about 215,000 polygons. I am using a spatial filter in my execute call.  The result set is about 3,000 objects but it takes about 20 seconds to execute on a pretty fast machine.  Does OGR use the index file for this query? Is there something else that I can do to speed this up?
> 
> Thanks a lot,
> 
> Rostic

Rostic,

OGR (and Shapelib) do not currently take advantage of any kind of spatial
index for shapefiles.  The ESRI supported version of the spatial index is
not documented, and I haven't worked out the format.  I have been working
on adding support for MapServer style spatial indexes in the shapefile driver
but that works is still sitting half-finished in my local source tree (as it
has for a month or two) so I don't know when it will be available.

I'm afraid there is not direct way of doing fast spatial queries with OGR
on shapefiles at this time. OGR does support fast spatial searching for some
formats such as MapInfo binary files, and most of the spatial RDBMS environments.

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