Skip to content
Permalink
Browse files

Merge pull request #36992 from qgis/revert-36713-unittest_wfs_within_…

…srsname

Revert "Add unit test for WFS Post GetFeature Within"
  • Loading branch information
elpaso committed Jun 5, 2020
2 parents cbd3068 + ec0368e commit 3cd210e12f0a0d29bbfe9568c2c677a2eb46383b
@@ -213,14 +213,11 @@ def wfs_getfeature_post_compare(self, requestid, request):
self.result_compare(
'wfs_getfeature_{}.txt'.format(requestid),
"GetFeature in POST for '{}' failed.".format(requestid),
header,
body
header, body,
)

@unittest.expectedFailure("Issue #36398: QGIS Server: WFS Request does not use SrsName on the geometry")
def test_getfeature_post(self):
tests = []
expectNotEqualTests = []

template = """<?xml version="1.0" encoding="UTF-8"?>
<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">
@@ -260,89 +257,6 @@ def test_getfeature_post(self):
"""
tests.append(('srsname_post', srsTemplate.format("")))

# Issue https://github.com/qgis/QGIS/issues/36398
# Check get feature within linear ring with srsName=EPSG:4326
within4326FilterTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<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">
<wfs:Query typeName="testlayer" srsName="EPSG:4326" xmlns:feature="http://www.qgis.org/gml">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<Within>
<PropertyName>geometry</PropertyName>
<Polygon xmlns="http://www.opengis.net/gml" srsName="EPSG:4326">
<exterior>
<LinearRing srsName="EPSG:4326">
<posList srsDimension="2">
8 44
9 44
9 45
8 45
8 44
</posList>
</LinearRing>
</exterior>
</Polygon>
</Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
"""
tests.append(('within4326FilterTemplate_post', within4326FilterTemplate.format("")))

# Keep the coordinate in 4326, but change the srsName to 3857 (should returns different result)
# The reference file (withinFake3857FilterTemplate_post.txt) is copied from within4326FilterTemplate_post.txt
withinFake3857FilterTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<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">
<wfs:Query typeName="testlayer" srsName="EPSG:4326" xmlns:feature="http://www.qgis.org/gml">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<Within>
<PropertyName>geometry</PropertyName>
<Polygon xmlns="http://www.opengis.net/gml" srsName="EPSG:4326">
<exterior>
<LinearRing srsName="EPSG:3857">
<posList srsDimension="2">
8 44
9 44
9 45
8 45
8 44
</posList>
</LinearRing>
</exterior>
</Polygon>
</Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
"""
expectNotEqualTests.append(('withinFake3857FilterTemplate_post', withinFake3857FilterTemplate.format("")))

# Now test with EPSG 3857 and proper 3857 coordinates
within3857FilterTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<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">
<wfs:Query typeName="testlayer" srsName="EPSG:4326" xmlns:feature="http://www.qgis.org/gml">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<Within>
<PropertyName>geometry</PropertyName>
<Polygon xmlns="http://www.opengis.net/gml" srsName="EPSG:4326">
<exterior>
<LinearRing srsName="EPSG:3857">
<posList srsDimension="2">
890555.93 5465442.18
1001875.42, 5465442.18
1001875.42, 5621521.49
890555.93, 5621521.49
890555.93 5465442.18
</posList>
</LinearRing>
</exterior>
</Polygon>
</Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
"""
tests.append(('within3857FilterTemplate_post', within3857FilterTemplate.format("")))

srsTwoLayersTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<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">
<wfs:Query typeName="testlayer" srsName="EPSG:3857" xmlns:feature="http://www.qgis.org/gml">
@@ -476,11 +390,6 @@ def test_getfeature_post(self):
"""
tests.append(('nobbox_post', template.format("")))

for id, req in expectNotEqualTests:
errorMsg = 'Expect different XML response for %s' % id
with self.assertRaises(AssertionError, msg=errorMsg):
self.wfs_getfeature_post_compare(id, req)

for id, req in tests:
self.wfs_getfeature_post_compare(id, req)

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 3cd210e

Please sign in to comment.
You can’t perform that action at this time.