[Gdal-dev] ogr find neighbours

Didrik Pinte dpinte at itae.be
Wed May 10 11:41:08 EDT 2006


Le mercredi 10 mai 2006 à 10:58 -0400, Frank Warmerdam a écrit :
> 
> Didrik,
> 
> Compute the bounding box of a geometry using the GetEnvelope()
> method which should return a (xmin,ymin,xmax,ymax) tuple.
> Grow it out by 1% or so. Then use it with SetSpatialFilterRect() on
> the layer before you start fetching features to compare to.
> The .shx file is an index allowing us to lookup up a particular shape
> quickly based on it's index.  It is already used by OGR as needed.  It
> is not a spatial index.  You might want to read over the shapefile driver
> page to see how to create shapefile spatial indexes with ogr.

Frank,

That's improving the method.

I've added a spatial index to the file (the .qix file appeared), added a
SpatialFilterRect on the selection (works fine).

The time to create the list for the 11 polygons now has fallen to 19
seconds. The spared time comes directly from the use of
SpatialFilterRect.

Do you have any other brilliant idea to get some more seconds spared ?

Thanks a lot for your help

Didrik




More information about the Gdal-dev mailing list