Ticket #2492 (new enhancement)

Opened 5 years ago

Last modified 2 years ago

WFS Filter : enhance support for spatial operations

Reported by: assefa Owned by: assefa
Priority: normal Milestone: FUTURE
Component: WFS Server Version: unspecified
Severity: normal Keywords:
Cc:

Description

Initially reported by Bart,

we can't get a WFS Intersects filter to work against ArcSDE. It seems Mapserver retrieves all the rows and tries and let GEOS do the intersection. Is my impression correct?

Ideally it would use FILTER to set a spatial WHERE clause, something like:

SHAPE intersects POLYGON ((131970.3045120624 453455.16526662686, 131969.21075920813 453349.07123976306, 132075.30478607194 453347.9774869088, 132076.3985389262 453454.0715137726, 131970.3045120624 453455.16526662686))

Attachments

mapserver-5.2.0-2492.patch Download (2.5 KB) - added by dionw 5 years ago.

Change History

Changed 5 years ago by bartvde

It is not possible using ArcSDE to set a spatial filter using SQL, you can only use SQL of the underlying database. So using FILTER is not really an option.

It does work to set the map extent to the MBR of the search shape in the case of an INTERSECTS. I'll attach a slightly modified patch from Assefa which does this.

Changed 5 years ago by bartvde

Patch against 5.0.2:

--- mapogcfilter.c.orig 2008-03-05 09:21:04.000000000 +0100
+++ mapogcfilter.c      2008-03-05 10:08:53.000000000 +0100
@@ -141,6 +141,7 @@
     int bUseGeos = 0;
     int geos_operator = -1;
     shapeObj *psTmpShape = NULL;
+    rectObj sCurrentExtent;

     if (!psNode || !map || iLayerIndex < 0 ||
         iLayerIndex > map->numlayers-1)
@@ -381,7 +382,27 @@
 #endif
             }
             else
+            {
+              if ( geos_operator == MS_GEOS_INTERSECTS)
+              {
+                sCurrentExtent.minx = map->extent.minx;
+                sCurrentExtent.miny = map->extent.miny;
+                sCurrentExtent.maxx = map->extent.maxx;
+                sCurrentExtent.maxy = map->extent.maxy;
+                map->extent.minx = psQueryShape->bounds.minx;
+                map->extent.miny = psQueryShape->bounds.miny;
+                map->extent.maxx = psQueryShape->bounds.maxx;
+                map->extent.maxy = psQueryShape->bounds.maxy;
+              }
               msQueryByOperator(map, lp->index,  psQueryShape, geos_operator);
+              if ( geos_operator == MS_GEOS_INTERSECTS)
+              {
+                   map->extent.minx = sCurrentExtent.minx;
+                   map->extent.miny = sCurrentExtent.miny;
+                   map->extent.maxx = sCurrentExtent.maxx;
+                   map->extent.maxy = sCurrentExtent.maxy;
+              }
+            }
         }
         else
         {

Changed 5 years ago by dionw

Changed 5 years ago by dionw

Above attachment is an update of bartvde's patch against 5.2.0-beta4.

Changed 5 years ago by assefa

  • milestone changed from FUTURE to 5.4 release

This has to wait until 5.2 is released. I am setting it to 5.4 but we can possibly add it for 5.2.1

Changed 4 years ago by dmorissette

  • milestone changed from 5.6 release to 6.0 release

Changed 3 years ago by bartvde

Assefa, do you have any idea whether or not this is still an issue in trunk?

Changed 3 years ago by bartvde

A Within filter with a polygon on an Oracle layer does a full table scan in MS 5.6, so this is still a problem.

Changed 2 years ago by assefa

  • milestone changed from 6.0 release to FUTURE

All drivers need to address this. RFC http://mapserver.org/development/rfc/ms-rfc-64.html has laid the ground for drivers to implement a full spatial queries nativley. But until it is done, It is not there, Setting to FUTURE.

Note: See TracTickets for help on using tickets.