[mapserver-commits] r10041 - branches/branch-5-6/mapserver

svn at osgeo.org svn at osgeo.org
Thu Apr 1 15:15:33 EDT 2010


Author: assefa
Date: 2010-04-01 15:15:32 -0400 (Thu, 01 Apr 2010)
New Revision: 10041

Modified:
   branches/branch-5-6/mapserver/HISTORY.TXT
   branches/branch-5-6/mapserver/mapwfslayer.c
Log:
Add the ogc namspace to filters generated by Mapserver (#3414)

Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT	2010-04-01 19:11:51 UTC (rev 10040)
+++ branches/branch-5-6/mapserver/HISTORY.TXT	2010-04-01 19:15:32 UTC (rev 10041)
@@ -15,13 +15,15 @@
 Version 5.6.4 (????-??-??):
 ---------------------------
  
+- Add the ogc namspace to filters generated by Mapserver (#3414)
+
 - Fix MS_NONSQUARE to work in mode=map (#3413)
 
 - Improve error message when loadQuery() filename extension check fails (#3302)
 
 - Fix GetLegendGraphic using keyimages (#3398)
 
-- Fix getFeatureInfo quries on WFS layers (#3403)
+- Fix getFeatureInfo queries on WFS layers (#3403)
 
 - Fixed mapstring.c build problem related to errno (#3401).
 

Modified: branches/branch-5-6/mapserver/mapwfslayer.c
===================================================================
--- branches/branch-5-6/mapserver/mapwfslayer.c	2010-04-01 19:11:51 UTC (rev 10040)
+++ branches/branch-5-6/mapserver/mapwfslayer.c	2010-04-01 19:15:32 UTC (rev 10041)
@@ -156,9 +156,14 @@
     pszTmp = msOWSLookupMetadata(&(lp->metadata), "FO", "filter");
     if (pszTmp && strlen(pszTmp) > 0)
     {
-        psParams->pszFilter = malloc(sizeof(char)*(strlen(pszTmp)+17+1));
-        sprintf(psParams->pszFilter, "<Filter>%s</Filter>", pszTmp);
-        /* <Filter xmlns=\"http://www.opengis.net/ogc\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.opengis.net/ogc ../filter/1.0.0/filter.xsd http://www.opengis.net/gml../gml/2.1/geometry.xsd\"> */
+        if (strstr(pszTmp, "<Filter>") !=NULL || strstr(pszTmp, "<ogc:Filter>") != NULL)
+          psParams->pszFilter = strdup(pszTmp);
+        else
+        {
+            psParams->pszFilter = msStringConcatenate(psParams->pszFilter, "<ogc:Filter>");
+            psParams->pszFilter = msStringConcatenate(psParams->pszFilter, pszTmp);
+            psParams->pszFilter = msStringConcatenate(psParams->pszFilter, "</ogc:Filter>");
+        }
     }
 
      pszTmp = msOWSLookupMetadata(&(lp->metadata), "FO", "maxfeatures");
@@ -246,40 +251,41 @@
     else
     {
         pszFilter = (char *)malloc(sizeof(char)*500);
-        sprintf(pszFilter, "<Filter>\n"
-"<BBOX>\n"
-"<PropertyName>Geometry</PropertyName>\n"
-"<Box>\n"
-"<coordinates>%f,%f %f,%f</coordinates>\n"
-"</Box>\n"
-"</BBOX>\n"
-"</Filter>",bbox->minx, bbox->miny, bbox->maxx, bbox->maxy);
+        sprintf(pszFilter, "<ogc:Filter>\n"
+"<ogc:BBOX>\n"
+"<ogc:PropertyName>Geometry</ogc:PropertyName>\n"
+"<gml:Box>\n"
+"<gml:coordinates>%f,%f %f,%f</gml:coordinates>\n"
+"</gml:Box>\n"
+"</ogc:BBOX>\n"
+"</ogc:Filter>",bbox->minx, bbox->miny, bbox->maxx, bbox->maxy);
     }
 
     pszPostReq = (char *)malloc(sizeof(char)*(strlen(pszFilter)+500));
     if (psParams->nMaxFeatures > 0)
       sprintf(pszPostReq, "<?xml version=\"1.0\" ?>\n"
-"<GetFeature\n"
+"<wfs:GetFeature\n"
 "service=\"WFS\"\n"
 "version=\"1.0.0\"\n"
 "maxFeatures=\"%d\"\n"
 "outputFormat=\"GML2\">\n"
-"<Query typeName=\"%s\">\n"
+"<wfs:Query typeName=\"%s\">\n"
 "%s"
-"</Query>\n"
-"</GetFeature>\n", psParams->nMaxFeatures, psParams->pszTypeName, pszFilter);
+"</wfs:Query>\n"
+"</wfs:GetFeature>\n", psParams->nMaxFeatures, psParams->pszTypeName, pszFilter);
     else
       sprintf(pszPostReq, "<?xml version=\"1.0\" ?>\n"
-"<GetFeature\n"
+"<wfs:GetFeature\n"
 "service=\"WFS\"\n"
 "version=\"1.0.0\"\n"
 "outputFormat=\"GML2\">\n"
-"<Query typeName=\"%s\">\n"
+"<wfs:Query typeName=\"%s\">\n"
 "%s"
-"</Query>\n"
-"</GetFeature>\n", psParams->pszTypeName, pszFilter);
-    if (psParams->pszFilter == NULL)
-      free(pszFilter);
+"</wfs:Query>\n"
+"</wfs:GetFeature>\n", psParams->pszTypeName, pszFilter);
+    
+    if (psParams->pszFilter != NULL)
+      msFree(pszFilter);
 
 
     return pszPostReq; 



More information about the mapserver-commits mailing list