Permalink
Browse files

WFS 2.0: implement GetPropertyValue request

  • Loading branch information...
rouault committed Nov 3, 2013
1 parent 2eee58a commit 598e2234c0fd777ba626c2b20029f3e8e822432c
Showing with 934 additions and 527 deletions.
  1. +3 −2 mapfile.c
  2. +26 −17 mapgml.c
  3. +3 −1 mapows.h
  4. +1 −1 mapserver.h
  5. +894 −502 mapwfs.c
  6. +6 −3 mapwfs20.c
  7. +1 −1 msautotest
View
@@ -354,7 +354,7 @@ int msGetSymbolIndex(symbolSetObj *symbols, char *name, int try_addimage_if_notf
/*
** Return the index number for a given layer based on its name.
*/
-int msGetLayerIndex(mapObj *map, char *name)
+int msGetLayerIndex(mapObj *map, const char *name)
{
int i;
@@ -369,7 +369,8 @@ int msGetLayerIndex(mapObj *map, char *name)
return(-1);
}
-int msGetClassIndex(layerObj *layer, char *name)
+static
+int msGetClassIndex(layerObj *layer, const char *name)
{
int i;
View
@@ -1355,7 +1355,8 @@ int msGMLWriteQuery(mapObj *map, char *filename, const char *namespaces)
** Similar to msGMLWriteQuery() but tuned for use with WFS
*/
int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_prefix,
- OWSGMLVersion outputformat, int nWFSVersion, int bUseURN)
+ OWSGMLVersion outputformat, int nWFSVersion, int bUseURN,
+ int bGetPropertyValueRequest)
{
#ifdef USE_WFS_SVR
int status;
@@ -1381,7 +1382,8 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
bSwapAxis = msIsAxisInvertedProj(&(map->projection));
/* Need to start with BBOX of the whole resultset */
- if (msGetQueryResultBounds(map, &resultBounds) > 0) {
+ if (!bGetPropertyValueRequest &&
+ msGetQueryResultBounds(map, &resultBounds) > 0) {
char* srs = NULL;
if (bSwapAxis) {
tmp = resultBounds.minx;
@@ -1499,21 +1501,25 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
** start this feature
*/
if( nWFSVersion == OWS_2_0_0 )
- msIO_fprintf(stream, " <wfs:member>\n");
+ msIO_fprintf(stream, " <wfs:member>\n");
else
- msIO_fprintf(stream, " <gml:featureMember>\n");
+ msIO_fprintf(stream, " <gml:featureMember>\n");
if(msIsXMLTagValid(layerName) == MS_FALSE)
- msIO_fprintf(stream, "<!-- WARNING: The value '%s' is not valid in a XML tag context. -->\n", layerName);
+ msIO_fprintf(stream, "<!-- WARNING: The value '%s' is not valid in a XML tag context. -->\n", layerName);
if(featureIdIndex != -1) {
- pszFID = (char*) msSmallMalloc( strlen(lp->name) + 1 + strlen(shape.values[featureIdIndex]) + 1 );
- sprintf(pszFID, "%s.%s", lp->name, shape.values[featureIdIndex]);
- if(outputformat == OWS_GML2)
- msIO_fprintf(stream, " <%s fid=\"%s\">\n", layerName, pszFID);
- else /* OWS_GML3 or OWS_GML32 */
- msIO_fprintf(stream, " <%s gml:id=\"%s\">\n", layerName, pszFID);
+ pszFID = (char*) msSmallMalloc( strlen(lp->name) + 1 + strlen(shape.values[featureIdIndex]) + 1 );
+ sprintf(pszFID, "%s.%s", lp->name, shape.values[featureIdIndex]);
+ if( !bGetPropertyValueRequest )
+ {
+ if(outputformat == OWS_GML2)
+ msIO_fprintf(stream, " <%s fid=\"%s\">\n", layerName, pszFID);
+ else /* OWS_GML3 or OWS_GML32 */
+ msIO_fprintf(stream, " <%s gml:id=\"%s\">\n", layerName, pszFID);
+ }
} else {
- pszFID = msStrdup("");
- msIO_fprintf(stream, " <%s>\n", layerName);
+ pszFID = msStrdup("");
+ if( !bGetPropertyValueRequest )
+ msIO_fprintf(stream, " <%s>\n", layerName);
}
if (bSwapAxis)
@@ -1522,7 +1528,8 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
/* write the feature geometry and bounding box */
if(!(geometryList && geometryList->numgeometries == 1 &&
strcasecmp(geometryList->geometries[0].name, "none") == 0)) {
- gmlWriteBounds(stream, outputformat, &(shape.bounds), srs, " ", "gml");
+ if( !bGetPropertyValueRequest )
+ gmlWriteBounds(stream, outputformat, &(shape.bounds), srs, " ", "gml");
gmlWriteGeometry(stream, geometryList, outputformat, &(shape), srs, namespace_prefix, " ", pszFID);
}
@@ -1547,8 +1554,10 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
for(k=0; k<groupList->numgroups; k++)
msGMLWriteGroup(stream, &(groupList->groups[k]), &shape, itemList, constantList, namespace_prefix, " ");
- /* end this feature */
- msIO_fprintf(stream, " </%s>\n", layerName);
+ if( !bGetPropertyValueRequest )
+ /* end this feature */
+ msIO_fprintf(stream, " </%s>\n", layerName);
+
if( nWFSVersion == OWS_2_0_0 )
msIO_fprintf(stream, " </wfs:member>\n");
else
@@ -1575,7 +1584,7 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
return(MS_SUCCESS);
#else /* Stub for mapscript */
- msSetError(MS_MISCERR, "WMS server support not enabled", "msGMLWriteWFSQuery()");
+ msSetError(MS_MISCERR, "WFS server support not enabled", "msGMLWriteWFSQuery()");
return MS_FAILURE;
#endif /* USE_WFS_SVR */
}
View
@@ -65,6 +65,7 @@ typedef struct {
char *pszSections;
char *pszSortBy; /* Not implemented yet */
char *pszLanguage;
+ char *pszValueReference; /* For GetValueReference */
} wfsParamsObj;
/*
@@ -404,7 +405,8 @@ MS_DLL_EXPORT int msGMLWriteQuery(mapObj *map, char *filename, const char *names
#ifdef USE_WFS_SVR
MS_DLL_EXPORT int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *wfs_namespace,
- OWSGMLVersion outputformat, int nWFSVersion, int bUseURN);
+ OWSGMLVersion outputformat, int nWFSVersion, int bUseURN,
+ int bGetPropertyValueRequest);
#endif
View
@@ -1985,7 +1985,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
/* mapfile.c */
MS_DLL_EXPORT int msValidateParameter(char *value, char *pattern1, char *pattern2, char *pattern3, char *pattern4);
- MS_DLL_EXPORT int msGetLayerIndex(mapObj *map, char *name);
+ MS_DLL_EXPORT int msGetLayerIndex(mapObj *map, const char *name);
MS_DLL_EXPORT int msGetSymbolIndex(symbolSetObj *set, char *name, int try_addimage_if_notfound);
MS_DLL_EXPORT mapObj *msLoadMap(char *filename, char *new_mappath);
MS_DLL_EXPORT int msTransformXmlMapfile(const char *stylesheet, const char *xmlMapfile, FILE *tmpfile);
Oops, something went wrong.

0 comments on commit 598e223

Please sign in to comment.