[mapserver-commits] r9597 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Dec 7 19:39:19 EST 2009


Author: assefa
Date: 2009-12-07 19:39:17 -0500 (Mon, 07 Dec 2009)
New Revision: 9597

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapwfs.c
Log:
MAP EXTENT truncates GetFeature requests for data outside bounds

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-12-07 23:24:39 UTC (rev 9596)
+++ trunk/mapserver/HISTORY.TXT	2009-12-08 00:39:17 UTC (rev 9597)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- MAP EXTENT truncates GetFeature requests for data outside bounds (#1287)
+
 - Added msStringSplitComplex function (#471)
 
 - Mapserver WFS should send maxfeatures to the spatial database (#2605)

Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c	2009-12-07 23:24:39 UTC (rev 9596)
+++ trunk/mapserver/mapwfs.c	2009-12-08 00:39:17 UTC (rev 9597)
@@ -1025,6 +1025,7 @@
   gmlNamespaceListObj *namespaceList=NULL; /* for external application schema support */
   char **papszPropertyName = NULL;
   int nPropertyNames = 0;
+  const char *pszMapSRS = NULL;
 
   /* Default filter is map extents */
   bbox = map->extent;
@@ -1052,7 +1053,7 @@
 
   if(paramsObj->pszTypeName) {
     int j, k, z;
-    const char *pszMapSRS = NULL;
+    
     char **tokens;
     int n=0, i=0;
     char szTmp[256];
@@ -1118,7 +1119,6 @@
 	
 	if (msWFSIsLayerSupported(lp) && lp->name && strcasecmp(lp->name, layers[k]) == 0) {
 	  const char *pszThisLayerSRS;
-          rectObj ext;
 	  bLayerFound = MS_TRUE;
 	  
 	  lp->status = MS_ON;
@@ -1235,31 +1235,8 @@
 		       "Invalid GetFeature Request: All TYPENAMES in a single GetFeature request must have been advertized in the same SRS.  Please check the capabilities and reformulate your request.",
 		       "msWFSGetFeature()");
 	    return msWFSException(map, "typename", "InvalidParameterValue", paramsObj->pszVersion);
-	  }
+	  }         
 
-          /* set the map extent to the layer extent */
-
-          /* get the extent of the layer (bbox will get further filtered later */
-          /* if the client specifies BBOX or a spatial filter */
-
-          if (msOWSGetLayerExtent(map, lp, "FO", &ext) == MS_SUCCESS) {
-            char szBuf[32];
-
-            if (pszMapSRS != NULL && strncmp(pszMapSRS, "EPSG:", 5) == 0) {
-              sprintf(szBuf, "init=epsg:%.10s", pszMapSRS+5);
-                
-              if (msLoadProjectionString(&(map->projection), szBuf) != 0) {
-                 msSetError(MS_WFSERR, "msLoadProjectionString() failed: %s", "msWFSGetFeature()", szBuf);
-                 return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion);
-              }
-            }
-
-            if (msProjectionsDiffer(&map->projection, &lp->projection) == MS_TRUE) {
-               msProjectRect(&lp->projection, &map->projection, &(ext));
-            }
-
-            bbox = map->extent = ext;
-          }
         }
       }
 
@@ -1689,19 +1666,67 @@
     /* to do things here. */
     if (!bFilterSet) {
 
-      map->query.type = MS_QUERY_BY_RECT; /* setup the query */
-      map->query.mode = MS_QUERY_MULTIPLE;
-      map->query.rect = bbox;
+      if (!bBBOXSet)
+      {
+          bbox = map->extent;
+          map->query.type = MS_QUERY_BY_RECT; /* setup the query */
+          map->query.mode = MS_QUERY_MULTIPLE;
+          for(j=0; j<map->numlayers; j++) 
+          {
+              layerObj *lp;
+              rectObj ext;
+              lp = GET_LAYER(map, j);
+              if (lp->status == MS_ON)
+              {
+                   if (msOWSGetLayerExtent(map, lp, "FO", &ext) == MS_SUCCESS) 
+                   {
+                       char szBuf[32];
 
-      if(msQueryByRect(map) != MS_SUCCESS) {
-	errorObj   *ms_error;
-	ms_error = msGetErrorObj();
+                       if (pszMapSRS != NULL && strncmp(pszMapSRS, "EPSG:", 5) == 0) {
+                           sprintf(szBuf, "init=epsg:%.10s", pszMapSRS+5);
+                
+                           if (msLoadProjectionString(&(map->projection), szBuf) != 0) {
+                               msSetError(MS_WFSERR, "msLoadProjectionString() failed: %s", "msWFSGetFeature()", szBuf);
+                               return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion);
+                           }
+                       }
+
+                       if (msProjectionsDiffer(&map->projection, &lp->projection) == MS_TRUE) {
+                           msProjectRect(&lp->projection, &map->projection, &(ext));
+                       }
+                       bbox = ext;
+                   }
+                   map->query.rect = bbox;
+                   map->query.layer = j;
+                   if(msQueryByRect(map) != MS_SUCCESS) 
+                   {
+                       errorObj   *ms_error;
+                       ms_error = msGetErrorObj();
 	
-	if(ms_error->code != MS_NOTFOUND) {
-          msSetError(MS_WFSERR, "ms_error->code not found", "msWFSGetFeature()");
-	  return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion);
-        }
+                       if(ms_error->code != MS_NOTFOUND) {
+                           msSetError(MS_WFSERR, "ms_error->code not found", "msWFSGetFeature()");
+                           return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion);
+                       }
+                   }
+              }
+          }
       }
+      else
+      {
+          map->query.type = MS_QUERY_BY_RECT; /* setup the query */
+          map->query.mode = MS_QUERY_MULTIPLE;
+          map->query.rect = bbox;
+
+          if(msQueryByRect(map) != MS_SUCCESS) {
+              errorObj   *ms_error;
+              ms_error = msGetErrorObj();
+	
+              if(ms_error->code != MS_NOTFOUND) {
+                  msSetError(MS_WFSERR, "ms_error->code not found", "msWFSGetFeature()");
+                  return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion);
+              }
+          }
+      }
     }
 
     /* if no results where written (TODO: this needs to be GML2/3 specific I imagine */



More information about the mapserver-commits mailing list