[mapserver-commits] r8662 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Sun Mar 8 11:58:01 EDT 2009
Author: tomkralidis
Date: 2009-03-08 11:58:01 -0400 (Sun, 08 Mar 2009)
New Revision: 8662
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapows.h
trunk/mapserver/mapwfs.c
Log:
add support for resultType (#2907)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-03-08 15:39:41 UTC (rev 8661)
+++ trunk/mapserver/HISTORY.TXT 2009-03-08 15:58:01 UTC (rev 8662)
@@ -18,6 +18,8 @@
- add support for SRSNAME parameter (#2899)
+- add support for resultType (#2907)
+
Version 5.4.0-beta3 (2009-3-5):
--------------------------------
Modified: trunk/mapserver/mapows.h
===================================================================
--- trunk/mapserver/mapows.h 2009-03-08 15:39:41 UTC (rev 8661)
+++ trunk/mapserver/mapows.h 2009-03-08 15:58:01 UTC (rev 8662)
@@ -107,6 +107,7 @@
char *pszOutputFormat; /* only used with DescibeFeatureType */
char *pszFeatureId;
char *pszSrs;
+ char *pszResultType;
} wfsParamsObj;
/*
Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c 2009-03-08 15:39:41 UTC (rev 8661)
+++ trunk/mapserver/mapwfs.c 2009-03-08 15:58:01 UTC (rev 8662)
@@ -1003,6 +1003,8 @@
char **aFIDLayers = NULL;
char **aFIDValues = NULL;
int iFIDLayers = 0;
+ int iNumberOfFeatures = 0;
+ int iResultTypeHits = 0;
gmlNamespaceListObj *namespaceList=NULL; /* for external application schema support */
@@ -1013,8 +1015,13 @@
/* */
/* __TODO__ Need to support XML encoded requests */
/* */
-
+ if (paramsObj->pszResultType != NULL)
+ {
+ if (strcasecmp(paramsObj->pszResultType, "hits") == 0)
+ iResultTypeHits = 1;
+ }
+
/* typename is mandatory unlsess featureid is specfied. We do not
support featureid */
if (paramsObj->pszTypeName==NULL && paramsObj->pszFeatureId == NULL)
@@ -1025,7 +1032,6 @@
return msWFSException(map, "typename", "MissingParameterValue", paramsObj->pszVersion);
}
-
if(paramsObj->pszTypeName) {
int j, k;
const char *pszMapSRS = NULL;
@@ -1497,6 +1503,13 @@
}
}
+ /* if no results where written (TODO: this needs to be GML2/3 specific I imagine */
+ for(i=0; i<map->numlayers; i++) {
+ if (GET_LAYER(map, i)->resultcache && GET_LAYER(map, i)->resultcache->numresults > 0)
+ iNumberOfFeatures += GET_LAYER(map, i)->resultcache->numresults;
+ break;
+ }
+
/*
** GetFeature response
*/
@@ -1597,8 +1610,8 @@
}
if(paramsObj->pszVersion && strncmp(paramsObj->pszVersion,"1.1",3) == 0 )
- msIO_printf(" xsi:schemaLocation=\"%s %sSERVICE=WFS&VERSION=%s&REQUEST=DescribeFeatureType&TYPENAME=%s&OUTPUTFORMAT=%s http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd\">\n",
- user_namespace_uri_encoded, script_url_encoded, encoded, encoded_typename, output_schema_format);
+ msIO_printf(" xsi:schemaLocation=\"%s %sSERVICE=WFS&VERSION=%s&REQUEST=DescribeFeatureType&TYPENAME=%s&OUTPUTFORMAT=%s http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd\" numberOfFeatures=\"%d\">\n",
+ user_namespace_uri_encoded, script_url_encoded, encoded, encoded_typename, output_schema_format, iNumberOfFeatures);
else
msIO_printf(" xsi:schemaLocation=\"%s %sSERVICE=WFS&VERSION=%s&REQUEST=DescribeFeatureType&TYPENAME=%s&OUTPUTFORMAT=%s\">\n",
user_namespace_uri_encoded, script_url_encoded, encoded, encoded_typename, output_schema_format);
@@ -1609,15 +1622,10 @@
msFree(encoded_typename);
/* handle case of maxfeatures = 0 */
- if(maxfeatures != 0)
+ if(maxfeatures != 0 && iResultTypeHits == 0)
msGMLWriteWFSQuery(map, stdout, maxfeatures, pszNameSpace, outputformat);
-
- /* if no results where written (TODO: this needs to be GML2/3 specific I imagine */
- for(i=0; i<map->numlayers; i++) {
- if (GET_LAYER(map, i)->resultcache && GET_LAYER(map, i)->resultcache->numresults > 0)
- break;
- }
- if ((i==map->numlayers) || (maxfeatures == 0)) {
+
+ if (((i==map->numlayers) || (maxfeatures == 0)) && iResultTypeHits == 0) {
msIO_printf(" <gml:boundedBy>\n");
msIO_printf(" <gml:null>missing</gml:null>\n");
msIO_printf(" </gml:boundedBy>\n");
@@ -1862,6 +1870,8 @@
free(wfsparams->pszOutputFormat);
if (wfsparams->pszSrs)
free(wfsparams->pszSrs);
+ if (wfsparams->pszResultType)
+ free(wfsparams->pszResultType);
}
}
@@ -1905,6 +1915,9 @@
else if (strcasecmp(request->ParamNames[i], "SRSNAME") == 0)
wfsparams->pszSrs = strdup(request->ParamValues[i]);
+ else if (strcasecmp(request->ParamNames[i], "RESULTTYPE") == 0)
+ wfsparams->pszResultType = strdup(request->ParamValues[i]);
+
else if (strcasecmp(request->ParamNames[i], "TYPENAME") == 0)
wfsparams->pszTypeName = strdup(request->ParamValues[i]);
@@ -2012,6 +2025,10 @@
if (pszValue)
wfsparams->pszService = strdup(pszValue);
+ pszValue = (char*)CPLGetXMLValue(psGetFeature, "resultType",
+ NULL);
+ if (pszValue)
+ wfsparams->pszResultType = strdup(pszValue);
pszValue = (char*)CPLGetXMLValue(psGetFeature, "maxFeatures",
NULL);
More information about the mapserver-commits
mailing list