Permalink
Browse files

WFS: take into account PROPERTYNAME with OGR output format (fixes #5573)

  • Loading branch information...
rouault committed Mar 27, 2018
1 parent 5c151d6 commit 563b175040b552faaa291b7319843f8f0f729260
Showing with 62 additions and 17 deletions.
  1. +19 −17 mapwfs.c
  2. +40 −0 msautotest/wxs/expected/wfsogr_ogroutput_propertyname.txt
  3. +3 −0 msautotest/wxs/wfs_ogr.map
View
@@ -3825,13 +3825,25 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
}
}
{
int i;
for(i=0;i<map->numlayers;i++)
{
layerObj* lp = GET_LAYER(map, i);
if( papszGMLGroups[i] )
msInsertHashTable(&(lp->metadata), "GML_GROUPS", papszGMLGroups[i]);
if( papszGMLIncludeItems[i] )
msInsertHashTable(&(lp->metadata), "GML_INCLUDE_ITEMS", papszGMLIncludeItems[i]);
if( papszGMLGeometries[i] )
msInsertHashTable(&(lp->metadata), "GML_GEOMETRIES", papszGMLGeometries[i]);
}
}
/* handle case of maxfeatures = 0 */
/*internally use a start index that start with 0 as the first index*/
if( psFormat == NULL ) {
if(maxfeatures != 0 && iResultTypeHits == 0)
{
layerObj* lp;
int i;
int bWFS2MultipleFeatureCollection = MS_FALSE;
/* Would make sense for WFS 1.1.0 too ! See #3576 */
@@ -3842,24 +3854,14 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
else if (useurn && strcasecmp(useurn, "false") == 0)
bUseURN = 0;
for(i=0;i<map->numlayers;i++)
{
lp = GET_LAYER(map, i);
if( papszGMLGroups[i] )
msInsertHashTable(&(lp->metadata), "GML_GROUPS", papszGMLGroups[i]);
if( papszGMLIncludeItems[i] )
msInsertHashTable(&(lp->metadata), "GML_INCLUDE_ITEMS", papszGMLIncludeItems[i]);
if( papszGMLGeometries[i] )
msInsertHashTable(&(lp->metadata), "GML_GEOMETRIES", papszGMLGeometries[i]);
}
/* For WFS 2.0, when we request several types, we must present each type */
/* in its own FeatureCollection (§ 11.3.3.5 ) */
if( nWFSVersion >= OWS_2_0_0 && iResultTypeHits != 1 )
{
int i;
int nLayersWithFeatures = 0;
for(i=0; i<map->numlayers; i++) {
lp = GET_LAYER(map, i);
layerObj* lp = GET_LAYER(map, i);
if(lp->resultcache && lp->resultcache->numresults > 0)
nLayersWithFeatures ++;
}
@@ -3878,7 +3880,7 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
/* Save the result cache that contains the features that we want to */
/* emit in the response */
for(i=0; i<map->numlayers; i++) {
lp = GET_LAYER(map, i);
layerObj* lp = GET_LAYER(map, i);
saveResultCache[i] = lp->resultcache;
if( lp->resultcache && lp->resultcache->numresults > 0) {
iLastNonEmptyLayer = i;
@@ -3888,7 +3890,7 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
/* Just dump one layer at a time */
for(i=0;i<map->numlayers;i++) {
lp = GET_LAYER(map, i);
layerObj* lp = GET_LAYER(map, i);
lp->resultcache = saveResultCache[i];
if( lp->resultcache && lp->resultcache->numresults > 0) {
msIO_fprintf(stdout, " <wfs:member>\n");
@@ -3913,7 +3915,7 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
/* Restore for later cleanup */
for(i=0; i<map->numlayers; i++) {
lp = GET_LAYER(map, i);
layerObj* lp = GET_LAYER(map, i);
lp->resultcache = saveResultCache[i];
}
msFree(saveResultCache);
@@ -0,0 +1,40 @@
Content-Type: multipart/mixed; boundary=xxOGRBoundaryxx
--xxOGRBoundaryxx
Content-Disposition: attachment; filename=road.mid
Content-Type: application/binary
Content-Transfer-Encoding: binary
""
--xxOGRBoundaryxx
Content-Disposition: attachment; filename=road.mif
Content-Type: application/binary
Content-Transfer-Encoding: binary
Version 300
Charset "Neutral"
Delimiter ","
CoordSys Earth Projection 3, 74, "m", -95, 49, 49, 77, 0, 0
Columns 1
NAME_E Char(26)
Data
Pline 14
2577257 430271.1875
2577292 420127.65625
2577297.5 418604.78125
2577491.75 417462.90625
2578069 415941.46875
2578836.5 414230.25
2579413.25 412899.1875
2580247.5 412070.84375
2580693.5 411149.46875
2580978.5 408984.375
2580750.5 407559.96875
2580066.75 405736.6875
2579326 403970.4375
2578927.5 402717.03125
Pen (1,2,0)
--xxOGRBoundaryxx--
@@ -63,6 +63,9 @@
#
# Exception when requesting layers with different SRS
# RUN_PARMS: wfsogr_exception_not_same_srs.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=multi,withnullvalues,popplace,road" > [RESULT]
#
# PropertyName and OGR output format (#5573)
# RUN_PARMS: wfsogr_ogroutput_propertyname.txt [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=road&PROPERTYNAME=name_e&MAXFEATURES=1&OUTPUTFORMAT=multimidmif" > [RESULT]
#
# WMS 1.1 - GetFeatureInfo
#

0 comments on commit 563b175

Please sign in to comment.