[Gdal-dev] ogr find neighbours

Frank Warmerdam warmerdam at pobox.com
Wed May 10 12:13:04 EDT 2006


Didrik Pinte wrote:
> 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,

Well, the other idea I mentioned was comparing the extent of your target
rectangle and the extent rectangle of the geometries you want to test
against it before doing the expensive GEOS based operations. But I think
you have already got essentially the same effect with the spatial filtering
so it likely isn't worth following up on.

The 19s isn't terrible for now, but your dataset (from the image) seems quite
small.  Scaling up to larger datasets the time should be roughly linear
in the number of features (instead of quadratic as it would be without the
local spatial filter).  But things are already slow enough that scaling up to
a *large* dataset will likely be untenable.

A big part of the cost of GEOS operations in OGR is that OGR is internally
converting the geometries to GEOS format internally for each requested
operation.  This could likely be improved in a few ways.  But moving to
something like PCL which Howard suggested may be more beneficial since it
apparently works with GEOS geometries natively which saves alot of
re-converting cost.  With PCL you might need to accomplish the local filtering
slightly differently.

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 OSGF, http://osgeo.org




More information about the Gdal-dev mailing list