Skip to content

Commit dab4437

Browse files
authored
Merge pull request #7208 from arnaud-morvan/wfs_srs_multilayer
[server] Fix BBOX SRS in WFS GetFeature POST with two queries
2 parents 59938c8 + 9ebb646 commit dab4437

File tree

3 files changed

+145
-4
lines changed

3 files changed

+145
-4
lines changed

src/server/services/wfs/qgswfsgetfeature.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ namespace QgsWfs
355355
outputCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( query.srsName );
356356
}
357357

358-
if ( onlyOneLayer && !featureRequest.filterRect().isEmpty() )
358+
if ( !featureRequest.filterRect().isEmpty() )
359359
{
360360
Q_NOWARN_DEPRECATED_PUSH
361-
QgsCoordinateTransform transform( outputCrs, requestCrs );
361+
QgsCoordinateTransform transform( outputCrs, vlayer->crs() );
362362
Q_NOWARN_DEPRECATED_POP
363363
try
364364
{
@@ -368,8 +368,10 @@ namespace QgsWfs
368368
{
369369
Q_UNUSED( cse );
370370
}
371-
372-
requestRect = featureRequest.filterRect();
371+
if ( onlyOneLayer )
372+
{
373+
requestRect = featureRequest.filterRect();
374+
}
373375
}
374376

375377
// Iterate through features

tests/src/python/test_qgsserver_wfs.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,34 @@ def test_getfeature_post(self):
229229
"""
230230
tests.append(('srsname_post', srsTemplate.format("")))
231231

232+
srsTwoLayersTemplate = """<?xml version="1.0" encoding="UTF-8"?>
233+
<wfs:GetFeature service="WFS" version="1.0.0" {} xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
234+
<wfs:Query typeName="testlayer" srsName="EPSG:3857" xmlns:feature="http://www.qgis.org/gml">
235+
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
236+
<ogc:BBOX>
237+
<ogc:PropertyName>geometry</ogc:PropertyName>
238+
<gml:Envelope xmlns:gml="http://www.opengis.net/gml">
239+
<gml:lowerCorner>890555.92634619 5465442.18332275</gml:lowerCorner>
240+
<gml:upperCorner>1001875.41713946 5621521.48619207</gml:upperCorner>
241+
</gml:Envelope>
242+
</ogc:BBOX>
243+
</ogc:Filter>
244+
</wfs:Query>
245+
<wfs:Query typeName="testlayer" srsName="EPSG:3857" xmlns:feature="http://www.qgis.org/gml">
246+
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
247+
<ogc:BBOX>
248+
<ogc:PropertyName>geometry</ogc:PropertyName>
249+
<gml:Envelope xmlns:gml="http://www.opengis.net/gml">
250+
<gml:lowerCorner>890555.92634619 5465442.18332275</gml:lowerCorner>
251+
<gml:upperCorner>1001875.41713946 5621521.48619207</gml:upperCorner>
252+
</gml:Envelope>
253+
</ogc:BBOX>
254+
</ogc:Filter>
255+
</wfs:Query>
256+
</wfs:GetFeature>
257+
"""
258+
tests.append(('srs_two_layers_post', srsTwoLayersTemplate.format("")))
259+
232260
sortTemplate = """<?xml version="1.0" encoding="UTF-8"?>
233261
<wfs:GetFeature service="WFS" version="1.0.0" {} xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
234262
<wfs:Query typeName="testlayer" xmlns:feature="http://www.qgis.org/gml">
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
Content-Type: text/xml; subtype=gml/2.1.2; charset=utf-8
2+
3+
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:qgs="http://www.qgis.org/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.qgis.org/gml ?MAP=/home/amorvan/dev/QGIS/tests/testdata/qgis_server/test_project_wfs.qgs&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=testlayer,testlayer&amp;OUTPUTFORMAT=XMLSCHEMA">
4+
<gml:boundedBy>
5+
<gml:Box srsName="EPSG:4326">
6+
<gml:coordinates cs="," ts=" ">8.203459,44.901395 8.203547,44.901483</gml:coordinates>
7+
</gml:Box>
8+
</gml:boundedBy>
9+
<gml:featureMember>
10+
<qgs:testlayer fid="testlayer.0">
11+
<gml:boundedBy>
12+
<gml:Box srsName="EPSG:3857">
13+
<gml:coordinates cs="," ts=" ">913209.03579284,5606025.23730414 913209.03579284,5606025.23730414</gml:coordinates>
14+
</gml:Box>
15+
</gml:boundedBy>
16+
<qgs:geometry>
17+
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857">
18+
<coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">913209.03579284,5606025.23730414</coordinates>
19+
</Point>
20+
</qgs:geometry>
21+
<qgs:id>1</qgs:id>
22+
<qgs:name>one</qgs:name>
23+
<qgs:utf8nameè>one èé</qgs:utf8nameè>
24+
</qgs:testlayer>
25+
</gml:featureMember>
26+
<gml:featureMember>
27+
<qgs:testlayer fid="testlayer.1">
28+
<gml:boundedBy>
29+
<gml:Box srsName="EPSG:3857">
30+
<gml:coordinates cs="," ts=" ">913214.67407005,5606017.87425818 913214.67407005,5606017.87425818</gml:coordinates>
31+
</gml:Box>
32+
</gml:boundedBy>
33+
<qgs:geometry>
34+
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857">
35+
<coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">913214.67407005,5606017.87425818</coordinates>
36+
</Point>
37+
</qgs:geometry>
38+
<qgs:id>2</qgs:id>
39+
<qgs:name>two</qgs:name>
40+
<qgs:utf8nameè>two àò</qgs:utf8nameè>
41+
</qgs:testlayer>
42+
</gml:featureMember>
43+
<gml:featureMember>
44+
<qgs:testlayer fid="testlayer.2">
45+
<gml:boundedBy>
46+
<gml:Box srsName="EPSG:3857">
47+
<gml:coordinates cs="," ts=" ">913204.91280263,5606011.45647302 913204.91280263,5606011.45647302</gml:coordinates>
48+
</gml:Box>
49+
</gml:boundedBy>
50+
<qgs:geometry>
51+
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857">
52+
<coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">913204.91280263,5606011.45647302</coordinates>
53+
</Point>
54+
</qgs:geometry>
55+
<qgs:id>3</qgs:id>
56+
<qgs:name>three</qgs:name>
57+
<qgs:utf8nameè>three èé↓</qgs:utf8nameè>
58+
</qgs:testlayer>
59+
</gml:featureMember>
60+
<gml:featureMember>
61+
<qgs:testlayer fid="testlayer.0">
62+
<gml:boundedBy>
63+
<gml:Box srsName="EPSG:3857">
64+
<gml:coordinates cs="," ts=" ">913209.03579284,5606025.23730414 913209.03579284,5606025.23730414</gml:coordinates>
65+
</gml:Box>
66+
</gml:boundedBy>
67+
<qgs:geometry>
68+
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857">
69+
<coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">913209.03579284,5606025.23730414</coordinates>
70+
</Point>
71+
</qgs:geometry>
72+
<qgs:id>1</qgs:id>
73+
<qgs:name>one</qgs:name>
74+
<qgs:utf8nameè>one èé</qgs:utf8nameè>
75+
</qgs:testlayer>
76+
</gml:featureMember>
77+
<gml:featureMember>
78+
<qgs:testlayer fid="testlayer.1">
79+
<gml:boundedBy>
80+
<gml:Box srsName="EPSG:3857">
81+
<gml:coordinates cs="," ts=" ">913214.67407005,5606017.87425818 913214.67407005,5606017.87425818</gml:coordinates>
82+
</gml:Box>
83+
</gml:boundedBy>
84+
<qgs:geometry>
85+
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857">
86+
<coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">913214.67407005,5606017.87425818</coordinates>
87+
</Point>
88+
</qgs:geometry>
89+
<qgs:id>2</qgs:id>
90+
<qgs:name>two</qgs:name>
91+
<qgs:utf8nameè>two àò</qgs:utf8nameè>
92+
</qgs:testlayer>
93+
</gml:featureMember>
94+
<gml:featureMember>
95+
<qgs:testlayer fid="testlayer.2">
96+
<gml:boundedBy>
97+
<gml:Box srsName="EPSG:3857">
98+
<gml:coordinates cs="," ts=" ">913204.91280263,5606011.45647302 913204.91280263,5606011.45647302</gml:coordinates>
99+
</gml:Box>
100+
</gml:boundedBy>
101+
<qgs:geometry>
102+
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857">
103+
<coordinates xmlns="http://www.opengis.net/gml" cs="," ts=" ">913204.91280263,5606011.45647302</coordinates>
104+
</Point>
105+
</qgs:geometry>
106+
<qgs:id>3</qgs:id>
107+
<qgs:name>three</qgs:name>
108+
<qgs:utf8nameè>three èé↓</qgs:utf8nameè>
109+
</qgs:testlayer>
110+
</gml:featureMember>
111+
</wfs:FeatureCollection>

0 commit comments

Comments
 (0)