Opened 13 years ago
Last modified 13 years ago
#3800 new enhancement
Add native spatial filtering to DB backends, starting with PostGIS
Reported by: | ejn | Owned by: | sdlime |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | MapServer C Library | Version: | svn-trunk (development) |
Severity: | normal | Keywords: | filter, query, postgis |
Cc: | assefa, sdlime, dmorissette |
Description
As posted on mapserver-dev, I have developed a patch against trunk which adds the capability for spatial DBs to natively process spatial queries rather than just pulling all the data into MapServer and deferring the spatial filter to GEOS.
The patch hooks into the existing function for preparing simple (non-spatial) SQL for the DB backends, based on the FilterEncodingNode representation. As such it fits into the current processing path rather than the planned one (databases consuming MapServer's common filter encoding representation).
In this version, each DB driver supporting native spatial filtering must implement an additional vtable function
char *(*LayerBuildSpatialSQLForFilterNode)(FilterEncodingNode *filterNode, layerObj *layer)
and the knowledge of this must be inserted at the branching point in FLTLayerApplyCondSQLFilterToLayer.
The attached patch impements the hooks and the required function for the PostGIS driver.
Attachments (1)
Change History (5)
by , 13 years ago
Attachment: | NativeSpatialFilter_PostGIS.patch added |
---|
comment:1 by , 13 years ago
Cc: | added |
---|
I'd like to hear what Assefa thinks of this approach for Filter Encoding support, as an alternative to the current SQL generation in the filter encoding code.
comment:2 by , 13 years ago
I think the common filtering can help here in many ways, including security. We should be able to implement prepared statement binding since I think it's clear in the filter token list which tokens need to be bound...
Steve
comment:3 by , 13 years ago
Daniel, I think the approach proposed in the patch is an extension of what we currently do, that is generating sql in the filter encoding.
My understanding is that we want to go away from that and have the filter encoding just produce the common expressions. These expressions would then be used at driver level to generate the appropriate sql. I am not how easy how easy it is to parse the common expressions at driver level but basically the patch, instead of paring the filter encoding node structure, would parse the expressions and needs to be moved inside mapostigis.c
I think that fact that we want to use the common expressions was mentioned when this patch was initially proposed.
comment:4 by , 13 years ago
Thank you Steve and Assefa for pointing me at the light. I guess that means this patch is not the ultimate solution and the common filter stuff is still the way to go for 6.2 then.
Patch to add native spatial filtering to PostGIS driver