Skip to content

Commit 598e223

Browse files
committed
WFS 2.0: implement GetPropertyValue request
1 parent 2eee58a commit 598e223

File tree

7 files changed

+934
-527
lines changed

7 files changed

+934
-527
lines changed

mapfile.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ int msGetSymbolIndex(symbolSetObj *symbols, char *name, int try_addimage_if_notf
354354
/*
355355
** Return the index number for a given layer based on its name.
356356
*/
357-
int msGetLayerIndex(mapObj *map, char *name)
357+
int msGetLayerIndex(mapObj *map, const char *name)
358358
{
359359
int i;
360360

@@ -369,7 +369,8 @@ int msGetLayerIndex(mapObj *map, char *name)
369369
return(-1);
370370
}
371371

372-
int msGetClassIndex(layerObj *layer, char *name)
372+
static
373+
int msGetClassIndex(layerObj *layer, const char *name)
373374
{
374375
int i;
375376

mapgml.c

+26-17
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,8 @@ int msGMLWriteQuery(mapObj *map, char *filename, const char *namespaces)
13551355
** Similar to msGMLWriteQuery() but tuned for use with WFS
13561356
*/
13571357
int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_prefix,
1358-
OWSGMLVersion outputformat, int nWFSVersion, int bUseURN)
1358+
OWSGMLVersion outputformat, int nWFSVersion, int bUseURN,
1359+
int bGetPropertyValueRequest)
13591360
{
13601361
#ifdef USE_WFS_SVR
13611362
int status;
@@ -1381,7 +1382,8 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
13811382
bSwapAxis = msIsAxisInvertedProj(&(map->projection));
13821383

13831384
/* Need to start with BBOX of the whole resultset */
1384-
if (msGetQueryResultBounds(map, &resultBounds) > 0) {
1385+
if (!bGetPropertyValueRequest &&
1386+
msGetQueryResultBounds(map, &resultBounds) > 0) {
13851387
char* srs = NULL;
13861388
if (bSwapAxis) {
13871389
tmp = resultBounds.minx;
@@ -1499,21 +1501,25 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
14991501
** start this feature
15001502
*/
15011503
if( nWFSVersion == OWS_2_0_0 )
1502-
msIO_fprintf(stream, " <wfs:member>\n");
1504+
msIO_fprintf(stream, " <wfs:member>\n");
15031505
else
1504-
msIO_fprintf(stream, " <gml:featureMember>\n");
1506+
msIO_fprintf(stream, " <gml:featureMember>\n");
15051507
if(msIsXMLTagValid(layerName) == MS_FALSE)
1506-
msIO_fprintf(stream, "<!-- WARNING: The value '%s' is not valid in a XML tag context. -->\n", layerName);
1508+
msIO_fprintf(stream, "<!-- WARNING: The value '%s' is not valid in a XML tag context. -->\n", layerName);
15071509
if(featureIdIndex != -1) {
1508-
pszFID = (char*) msSmallMalloc( strlen(lp->name) + 1 + strlen(shape.values[featureIdIndex]) + 1 );
1509-
sprintf(pszFID, "%s.%s", lp->name, shape.values[featureIdIndex]);
1510-
if(outputformat == OWS_GML2)
1511-
msIO_fprintf(stream, " <%s fid=\"%s\">\n", layerName, pszFID);
1512-
else /* OWS_GML3 or OWS_GML32 */
1513-
msIO_fprintf(stream, " <%s gml:id=\"%s\">\n", layerName, pszFID);
1510+
pszFID = (char*) msSmallMalloc( strlen(lp->name) + 1 + strlen(shape.values[featureIdIndex]) + 1 );
1511+
sprintf(pszFID, "%s.%s", lp->name, shape.values[featureIdIndex]);
1512+
if( !bGetPropertyValueRequest )
1513+
{
1514+
if(outputformat == OWS_GML2)
1515+
msIO_fprintf(stream, " <%s fid=\"%s\">\n", layerName, pszFID);
1516+
else /* OWS_GML3 or OWS_GML32 */
1517+
msIO_fprintf(stream, " <%s gml:id=\"%s\">\n", layerName, pszFID);
1518+
}
15141519
} else {
1515-
pszFID = msStrdup("");
1516-
msIO_fprintf(stream, " <%s>\n", layerName);
1520+
pszFID = msStrdup("");
1521+
if( !bGetPropertyValueRequest )
1522+
msIO_fprintf(stream, " <%s>\n", layerName);
15171523
}
15181524

15191525
if (bSwapAxis)
@@ -1522,7 +1528,8 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
15221528
/* write the feature geometry and bounding box */
15231529
if(!(geometryList && geometryList->numgeometries == 1 &&
15241530
strcasecmp(geometryList->geometries[0].name, "none") == 0)) {
1525-
gmlWriteBounds(stream, outputformat, &(shape.bounds), srs, " ", "gml");
1531+
if( !bGetPropertyValueRequest )
1532+
gmlWriteBounds(stream, outputformat, &(shape.bounds), srs, " ", "gml");
15261533
gmlWriteGeometry(stream, geometryList, outputformat, &(shape), srs, namespace_prefix, " ", pszFID);
15271534
}
15281535

@@ -1547,8 +1554,10 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
15471554
for(k=0; k<groupList->numgroups; k++)
15481555
msGMLWriteGroup(stream, &(groupList->groups[k]), &shape, itemList, constantList, namespace_prefix, " ");
15491556

1550-
/* end this feature */
1551-
msIO_fprintf(stream, " </%s>\n", layerName);
1557+
if( !bGetPropertyValueRequest )
1558+
/* end this feature */
1559+
msIO_fprintf(stream, " </%s>\n", layerName);
1560+
15521561
if( nWFSVersion == OWS_2_0_0 )
15531562
msIO_fprintf(stream, " </wfs:member>\n");
15541563
else
@@ -1575,7 +1584,7 @@ int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *default_namespace_
15751584
return(MS_SUCCESS);
15761585

15771586
#else /* Stub for mapscript */
1578-
msSetError(MS_MISCERR, "WMS server support not enabled", "msGMLWriteWFSQuery()");
1587+
msSetError(MS_MISCERR, "WFS server support not enabled", "msGMLWriteWFSQuery()");
15791588
return MS_FAILURE;
15801589
#endif /* USE_WFS_SVR */
15811590
}

mapows.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ typedef struct {
6565
char *pszSections;
6666
char *pszSortBy; /* Not implemented yet */
6767
char *pszLanguage;
68+
char *pszValueReference; /* For GetValueReference */
6869
} wfsParamsObj;
6970

7071
/*
@@ -404,7 +405,8 @@ MS_DLL_EXPORT int msGMLWriteQuery(mapObj *map, char *filename, const char *names
404405

405406
#ifdef USE_WFS_SVR
406407
MS_DLL_EXPORT int msGMLWriteWFSQuery(mapObj *map, FILE *stream, const char *wfs_namespace,
407-
OWSGMLVersion outputformat, int nWFSVersion, int bUseURN);
408+
OWSGMLVersion outputformat, int nWFSVersion, int bUseURN,
409+
int bGetPropertyValueRequest);
408410
#endif
409411

410412

mapserver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
19851985
/* mapfile.c */
19861986

19871987
MS_DLL_EXPORT int msValidateParameter(char *value, char *pattern1, char *pattern2, char *pattern3, char *pattern4);
1988-
MS_DLL_EXPORT int msGetLayerIndex(mapObj *map, char *name);
1988+
MS_DLL_EXPORT int msGetLayerIndex(mapObj *map, const char *name);
19891989
MS_DLL_EXPORT int msGetSymbolIndex(symbolSetObj *set, char *name, int try_addimage_if_notfound);
19901990
MS_DLL_EXPORT mapObj *msLoadMap(char *filename, char *new_mappath);
19911991
MS_DLL_EXPORT int msTransformXmlMapfile(const char *stylesheet, const char *xmlMapfile, FILE *tmpfile);

0 commit comments

Comments
 (0)