Permalink
Browse files

WFS: complementary fix for "wfs_use_default_extent_for_getfeature" "y…

…es" layers

Currently when doing a GetFeature request without filter and BBOX, but with
SRSNAME, a dummy bounding box is reprojected, making the result of the request invalid.

Complementary fix for 45037eb
  • Loading branch information...
rouault committed Jun 18, 2017
1 parent 6763da7 commit 1df03be1bbb3343f78e582ca04eb929e34f3a32c
Showing with 43 additions and 2 deletions.
  1. +3 −1 mapquery.c
  2. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_43.xml
  3. +2 −1 msautotest/wxs/wfs_ogr_native_sql.map
View
@@ -881,6 +881,7 @@ int msQueryByRect(mapObj *map)
char status;
shapeObj shape, searchshape;
rectObj searchrect, searchrectInMapProj;
const rectObj invalid_rect = MS_INIT_INVALID_RECT;
double layer_tolerance = 0, tolerance = 0;
int paging;
@@ -982,7 +983,8 @@ int msQueryByRect(mapObj *map)
#ifdef USE_PROJ
lp->project = msProjectionsDiffer(&(lp->projection), &(map->projection));
if(lp->project)
if(lp->project &&
memcmp( &searchrect, &invalid_rect, sizeof(searchrect) ) != 0 )
msProjectRect(&(map->projection), &(lp->projection), &searchrect); /* project the searchrect to source coords */
#endif
@@ -0,0 +1,38 @@
Content-Type: text/xml; subtype=gml/2.1.2; charset=UTF-8
<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:gml="http://www.opengis.net/gml"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://localhost/path/to/wfs_simple?SERVICE=WFS&amp;VERSION=2.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=towns_disable_default_extent_for_getfeature&amp;OUTPUTFORMAT=XMLSCHEMA http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd"
timeStamp="" numberMatched="unknown" numberReturned="1"
next="http://localhost/path/to/wfs_simple?SERVICE=WFS&amp;VERSION=2.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=towns_disable_default_extent_for_getfeature&amp;OUTPUTFORMAT=GML2&amp;COUNT=1&amp;SRSNAME=EPSG%3A4326&amp;STARTINDEX=1">
<wfs:boundedBy>
<gml:Box srsName="urn:ogc:def:crs:EPSG::4326">
<gml:coordinates>44.25795,11.15631 44.25795,11.15631</gml:coordinates>
</gml:Box>
</wfs:boundedBy>
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns_disable_default_extent_for_getfeature'. -->
<wfs:member>
<ms:towns_disable_default_extent_for_getfeature>
<gml:boundedBy>
<gml:Box srsName="urn:ogc:def:crs:EPSG::4326">
<gml:coordinates>44.25795,11.15631 44.25795,11.15631</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="urn:ogc:def:crs:EPSG::4326">
<gml:coordinates>44.25795,11.15631</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Grizzana Morandi</ms:name>
<ms:peoples>3694</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns_disable_default_extent_for_getfeature>
</wfs:member>
</wfs:FeatureCollection>
@@ -94,6 +94,7 @@
# RUN_PARMS: wfs_ogr_native_sql_41.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=towns&OUTPUTFORMAT=GML2&FILTER=<Filter><PropertyIsNotEqualTo><PropertyName>name</PropertyName><Literal>Fanano</Literal></PropertyIsNotEqualTo></Filter>&SORTBY=name" > [RESULT_DEVERSION]
# RUN_PARMS: wfs_ogr_native_sql_42.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=towns_disable_default_extent_for_getfeature&OUTPUTFORMAT=GML2&COUNT=1" > [RESULT_DEVERSION]
# RUN_PARMS: wfs_ogr_native_sql_43.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=towns_disable_default_extent_for_getfeature&OUTPUTFORMAT=GML2&COUNT=1&SRSNAME=EPSG:4326" > [RESULT_DEVERSION]
MAP
@@ -116,7 +117,7 @@ WEB
METADATA
"wfs_title" "Test simple wfs"
"wfs_onlineresource" "http://localhost/path/to/wfs_simple?"
"wfs_srs" "EPSG:32632"
"wfs_srs" "EPSG:32632 EPSG:4326"
"wfs_enable_request" "*"
END
END

0 comments on commit 1df03be

Please sign in to comment.