non-spatial query optimization

Frank Warmerdam warmerdam at POBOX.COM
Tue Feb 1 17:10:18 EST 2005


Folks,

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

For instance, in an RDBMS it results in a much more complex query that may
end up being optimized poorly.  In OGR having a spatial filter often screws
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 will
be interpreted as meaning there is no spatial component to be tested.

All the feature store providers will need to be updated accordingly, which
I am willing to do for the more straight forward ones (ie. Shapefiles, OGR,
PostGIS).  The other provider maintainer would need to implement this
themselves, though I would make a first pass through making the code return
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 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 mapserver-dev mailing list