[mapserver-commits] r10025 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Mar 29 09:50:17 EDT 2010


Author: assefa
Date: 2010-03-29 09:50:17 -0400 (Mon, 29 Mar 2010)
New Revision: 10025

Modified:
   trunk/mapserver/mapfile.c
   trunk/mapserver/mapwfs.c
Log:
Add support for srs parameter given as part of the bbox strng #3296

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2010-03-27 17:58:16 UTC (rev 10024)
+++ trunk/mapserver/mapfile.c	2010-03-29 13:50:17 UTC (rev 10025)
@@ -1194,6 +1194,7 @@
       const char *code;
 
       code = value + 21;
+
       while( *code != ':' && *code != '\0' )
           code++;
       if( *code == ':' )
@@ -1212,6 +1213,39 @@
           p->numargs = 2;
       }
   }
+  else if (strncasecmp(value, "urn:x-ogc:def:crs:EPSG:",23) == 0)
+  { /*this case is to account for OGC CITE tests where x-ogc was used
+      before the ogc name became an official NID. Note also we also account
+      for the fact that a space for the version of the espg is not used with CITE tests. 
+      (Syntax used could be urn:ogc:def:objectType:authority:code)*/ 
+    
+      char init_string[100];
+      const char *code;
+
+      if (value[23] == ':')
+        code = value + 23;
+      else
+        code = value + 22;
+
+      while( *code != ':' && *code != '\0' )
+          code++;
+      if( *code == ':' )
+          code++;
+
+      /* translate into PROJ.4 format. */
+      sprintf( init_string, "init=epsg:%s", code );
+
+      p->args = (char**)malloc(sizeof(char*) * 2);
+      p->args[0] = strdup(init_string);
+      p->numargs = 1;
+
+      if( atoi(code) >= 4000 && atoi(code) < 5000 )
+      {
+          p->args[1] = strdup("+epsgaxis=ne");
+          p->numargs = 2;
+      }
+    
+  }
   else if (strncasecmp(value, "urn:ogc:def:crs:OGC:",20) == 0 )
   { /* this is very preliminary urn support ... expand later */ 
       char init_string[100];

Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c	2010-03-27 17:58:16 UTC (rev 10024)
+++ trunk/mapserver/mapwfs.c	2010-03-29 13:50:17 UTC (rev 10025)
@@ -1256,6 +1256,7 @@
   char   *pszFilter = NULL;
   int bFilterSet = 0;
   int bBBOXSet = 0;
+  char *sBBoxSrs = NULL;
   int bFeatureIdSet = 0;
 
   char *pszNameSpace = NULL;
@@ -1659,8 +1660,10 @@
   if (paramsObj->pszBbox) {
     char **tokens;
     int n;
+    
+
     tokens = msStringSplit(paramsObj->pszBbox, ',', &n);
-    if (tokens==NULL || n != 4) {
+    if (tokens==NULL || (n != 4 && n !=5)) {
       msSetError(MS_WFSERR, "Wrong number of arguments for BBOX.", "msWFSGetFeature()");
       return msWFSException(map, "bbox", "InvalidParameterValue", paramsObj->pszVersion);
     }
@@ -1668,6 +1671,10 @@
     bbox.miny = atof(tokens[1]);
     bbox.maxx = atof(tokens[2]);
     bbox.maxy = atof(tokens[3]);
+    /*5th aregument is assumed to be projection*/
+    if (n == 5)
+      sBBoxSrs = strdup(tokens[4]);
+
     msFreeCharArray(tokens, n);
     bBBOXSet = 1;
     /* Note: BBOX SRS is implicit, it is the SRS of the selected */
@@ -2015,6 +2022,31 @@
       }
       else
       {
+          if (sBBoxSrs)
+          {
+              int status;
+              projectionObj sProjTmp;
+
+              msInitProjection(&sProjTmp);
+              /*do the axis order for now. It is unclear if the bbox are expected
+                ro respect the axis oder defined in the projectsion #3296*/
+              
+              if(strncmp(paramsObj->pszVersion,"1.1",3) == 0)
+              {
+                  if ((status=msLoadProjectionStringEPSG(&sProjTmp, sBBoxSrs)) == 0)
+                  {
+                      msAxisNormalizePoints( &sProjTmp, 1, &bbox.minx, &bbox.miny );
+                      msAxisNormalizePoints( &sProjTmp, 1, &bbox.maxx, &bbox.maxy );
+                  }
+              }
+              else
+                status = msLoadProjectionString(&sProjTmp, sBBoxSrs);
+               
+               if (status == 0 &&  map->projection.numargs > 0)
+                 msProjectRect(&sProjTmp, &map->projection, &bbox);
+
+               msFree(sBBoxSrs);
+          }
           map->query.type = MS_QUERY_BY_RECT; /* setup the query */
           map->query.mode = MS_QUERY_MULTIPLE;
           map->query.rect = bbox;



More information about the mapserver-commits mailing list