non-spatial query optimization

Steve Lime steve.lime at DNR.STATE.MN.US
Tue Feb 1 19:55:26 EST 2005

Ok with me...

>>> Frank Warmerdam <warmerdam at POBOX.COM> 02/01/05 4:10 PM >>>

Paul Ramsey pointed out that the current msSHPWhichShapes() function
a search rectangle.  This means that any sort of query against a feature
datasource in MapServer ends up having a bounding rectangle whether it
needed or not.  This can result in substantial complication and extra
in the underlying datastores to apply the spatial filter.

For instance, in an RDBMS it results in a much more complex query that
end up being optimized poorly.  In OGR having a spatial filter often
up optimizations in the underlying datasources as well.

I propose to change msSHPWhichShapes() to take a pointer to a rectObj,
instead of passing in a rectObj by value.  If the pointer is NULL it
be interpreted as meaning there is no spatial component to be tested.

All the feature store providers will need to be updated accordingly,
I am willing to do for the more straight forward ones (ie. Shapefiles,
PostGIS).  The other provider maintainer would need to implement this
themselves, though I would make a first pass through making the code
an error if a NULL rect was passed into these providers.

Are there any objections to me making such a change in MapServer 4.5?

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at
light and sound - activate the windows |
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the mapserver-dev mailing list