Skip to content

Commit 0baf3fa

Browse files
elpasonyalldawson
authored andcommitted
Merge pull request #8948 from elpaso/bugfix-20198-server-DescribeFeatureType-typename
Fix server WFS TYPENAME filter in describeFeatureType Cherry-picked from master 4909643
1 parent 823f2dd commit 0baf3fa

9 files changed

+861
-603
lines changed

src/server/services/wfs/qgswfsdescribefeaturetype.cpp

+1-13
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,7 @@ namespace QgsWfs
138138
}
139139
else
140140
{
141-
QString typeNames = request.parameter( QStringLiteral( "TYPENAME" ) );
142-
if ( !typeNames.isEmpty() )
143-
{
144-
QStringList typeNameSplit = typeNames.split( ',' );
145-
for ( int i = 0; i < typeNameSplit.size(); ++i )
146-
{
147-
QString typeName = typeNameSplit.at( i ).trimmed();
148-
if ( typeName.contains( ':' ) )
149-
typeNameList << typeName.section( ':', 1, 1 );
150-
else
151-
typeNameList << typeName;
152-
}
153-
}
141+
typeNameList = wfsParameters.typeNames();
154142
}
155143

156144
QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );

tests/src/python/test_qgsserver_wfs.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class TestQgsServerWFS(QgsServerTestBase):
4444
"""QGIS Server WFS Tests"""
4545

4646
# Set to True in child classes to re-generate reference files for this class
47-
#regenerate_reference = True
47+
regenerate_reference = False
4848

49-
def wfs_request_compare(self, request, version='', extra_query_string='', reference_base_name=None):
50-
project = self.testdata_path + "test_project_wfs.qgs"
49+
def wfs_request_compare(self, request, version='', extra_query_string='', reference_base_name=None, project_file="test_project_wfs.qgs"):
50+
project = self.testdata_path + project_file
5151
assert os.path.exists(project), "Project file not found: " + project
5252

5353
query_string = '?MAP=%s&SERVICE=WFS&REQUEST=%s' % (urllib.parse.quote(project), request)
@@ -385,6 +385,17 @@ def test_getFeature_EXP_FILTER_regression_20927(self):
385385
self.wfs_request_compare("GetFeature", '1.0.0', "SRSNAME=EPSG:4326&TYPENAME=testlayer&EXP_FILTER=intersects($geometry, geom_from_gml('<gml:Box> <gml:coordinates cs=\",\" ts=\" \">8.20344750430995617,44.9013881888184514 8.20347909100379269,44.90140004005827024</gml:coordinates></gml:Box>'))", 'wfs_getFeature_1_0_0_EXP_FILTER_gml_bbox_three')
386386
self.wfs_request_compare("GetFeature", '1.0.0', "SRSNAME=EPSG:4326&TYPENAME=testlayer&EXP_FILTER=intersects($geometry, geom_from_gml('<gml:Box> <gml:coordinates cs=\",\" ts=\" \">8.20348458304175665,44.90147459621791626 8.20351616973559317,44.9014864474577351</gml:coordinates></gml:Box>'))", 'wfs_getFeature_1_0_0_EXP_FILTER_gml_bbox_one')
387387

388+
def test_describeFeatureType(self):
389+
"""Test DescribeFeatureType with TYPENAME filters"""
390+
391+
project_file = "test_project_wms_grouped_layers.qgs"
392+
self.wfs_request_compare("DescribeFeatureType", '1.0.0', "TYPENAME=as_areas&", 'wfs_describeFeatureType_1_0_0_typename_as_areas', project_file=project_file)
393+
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "TYPENAME=as_areas&", 'wfs_describeFeatureType_1_1_0_typename_as_areas', project_file=project_file)
394+
self.wfs_request_compare("DescribeFeatureType", '1.0.0', "", 'wfs_describeFeatureType_1_0_0_typename_empty', project_file=project_file)
395+
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "", 'wfs_describeFeatureType_1_1_0_typename_empty', project_file=project_file)
396+
self.wfs_request_compare("DescribeFeatureType", '1.0.0', "TYPENAME=does_not_exist&", 'wfs_describeFeatureType_1_0_0_typename_wrong', project_file=project_file)
397+
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "TYPENAME=does_not_exist&", 'wfs_describeFeatureType_1_1_0_typename_wrong', project_file=project_file)
398+
388399

389400
if __name__ == '__main__':
390401
unittest.main()

tests/testdata/qgis_server/test_project_wms_grouped_layers.qgs

+534-587
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Content-Length: 1840
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
6+
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
7+
<complexType name="as_areasType">
8+
<complexContent>
9+
<extension base="gml:AbstractFeatureType">
10+
<sequence>
11+
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
12+
<element type="long" name="fid"/>
13+
<element type="int" name="gid"/>
14+
<element type="string" name="datum"/>
15+
<element type="string" name="bearbeiter"/>
16+
<element type="string" name="veranstaltung"/>
17+
<element type="string" name="beschriftung"/>
18+
<element type="string" name="name"/>
19+
<element type="string" name="flaechentyp"/>
20+
<element type="string" name="farbe"/>
21+
<element type="string" name="schraff_width"/>
22+
<element type="string" name="schraff_width_prt"/>
23+
<element type="string" name="schraff_size"/>
24+
<element type="string" name="schraff_size_prt"/>
25+
<element type="string" name="schraff_winkel"/>
26+
<element type="string" name="umrissfarbe"/>
27+
<element type="string" name="umrisstyp"/>
28+
<element type="string" name="umrissstaerke"/>
29+
<element type="string" name="umrissstaerke_prt"/>
30+
<element type="decimal" name="umfang"/>
31+
<element type="decimal" name="flaeche"/>
32+
<element type="string" name="bemerkung"/>
33+
<element type="string" name="last_change"/>
34+
</sequence>
35+
</extension>
36+
</complexContent>
37+
</complexType>
38+
</schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
Content-Length: 4894
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
6+
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
7+
<complexType name="as_areasType">
8+
<complexContent>
9+
<extension base="gml:AbstractFeatureType">
10+
<sequence>
11+
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
12+
<element type="long" name="fid"/>
13+
<element type="int" name="gid"/>
14+
<element type="string" name="datum"/>
15+
<element type="string" name="bearbeiter"/>
16+
<element type="string" name="veranstaltung"/>
17+
<element type="string" name="beschriftung"/>
18+
<element type="string" name="name"/>
19+
<element type="string" name="flaechentyp"/>
20+
<element type="string" name="farbe"/>
21+
<element type="string" name="schraff_width"/>
22+
<element type="string" name="schraff_width_prt"/>
23+
<element type="string" name="schraff_size"/>
24+
<element type="string" name="schraff_size_prt"/>
25+
<element type="string" name="schraff_winkel"/>
26+
<element type="string" name="umrissfarbe"/>
27+
<element type="string" name="umrisstyp"/>
28+
<element type="string" name="umrissstaerke"/>
29+
<element type="string" name="umrissstaerke_prt"/>
30+
<element type="decimal" name="umfang"/>
31+
<element type="decimal" name="flaeche"/>
32+
<element type="string" name="bemerkung"/>
33+
<element type="string" name="last_change"/>
34+
</sequence>
35+
</extension>
36+
</complexContent>
37+
</complexType>
38+
<element type="qgs:as_symbolsType" name="as_symbols" substitutionGroup="gml:_Feature"/>
39+
<complexType name="as_symbolsType">
40+
<complexContent>
41+
<extension base="gml:AbstractFeatureType">
42+
<sequence>
43+
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
44+
<element type="long" name="fid"/>
45+
<element type="int" name="gid"/>
46+
<element type="string" name="datum"/>
47+
<element type="string" name="bearbeiter"/>
48+
<element type="string" name="veranstaltung"/>
49+
<element type="string" name="beschriftung"/>
50+
<element type="string" name="name"/>
51+
<element type="string" name="form"/>
52+
<element type="string" name="groesse"/>
53+
<element type="string" name="groesse_red"/>
54+
<element type="string" name="winkel"/>
55+
<element type="string" name="farbe"/>
56+
<element type="string" name="bemerkung"/>
57+
<element type="string" name="last_change"/>
58+
</sequence>
59+
</extension>
60+
</complexContent>
61+
</complexType>
62+
<element type="qgs:cdb_labelsType" name="cdb_labels" substitutionGroup="gml:_Feature"/>
63+
<complexType name="cdb_labelsType">
64+
<complexContent>
65+
<extension base="gml:AbstractFeatureType">
66+
<sequence>
67+
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
68+
<element type="long" name="fid"/>
69+
<element type="decimal" name="AREA"/>
70+
<element type="decimal" name="PERIMETER"/>
71+
<element type="int" name="STADTTEILE"/>
72+
<element type="int" name="STADTTEI_1"/>
73+
<element type="int" name="S_A_"/>
74+
<element type="int" name="S_A_ID"/>
75+
<element type="string" name="O_NAME"/>
76+
<element type="string" name="ORTSTEIL"/>
77+
<element type="string" name="STADTTEIL"/>
78+
<element type="string" name="OT_SCHL"/>
79+
<element type="string" name="GEM_SCHL"/>
80+
<element type="decimal" name="ZVS"/>
81+
<element type="string" name="NAME"/>
82+
<element type="string" name="PLZ"/>
83+
<element type="string" name="KERNSTADT_"/>
84+
<element type="string" name="ORTSRATSBE"/>
85+
<element type="decimal" name="PLG_KITA"/>
86+
<element type="decimal" name="PLG_BERATU"/>
87+
<element type="decimal" name="PLG_JUFOE"/>
88+
<element type="decimal" name="VERFLECHTU"/>
89+
<element type="decimal" name="FUNKTIONSB"/>
90+
<element type="string" name="T_DATUM"/>
91+
<element type="string" name="Impfbez_Nr"/>
92+
<element type="string" name="Impfzentru"/>
93+
</sequence>
94+
</extension>
95+
</complexContent>
96+
</complexType>
97+
<element type="qgs:cdb_linesType" name="cdb_lines" substitutionGroup="gml:_Feature"/>
98+
<complexType name="cdb_linesType">
99+
<complexContent>
100+
<extension base="gml:AbstractFeatureType">
101+
<sequence>
102+
<element maxOccurs="1" type="gml:PolygonPropertyType" minOccurs="0" name="geometry"/>
103+
<element type="long" name="fid"/>
104+
<element type="int" name="id"/>
105+
<element type="string" name="typ"/>
106+
<element type="string" name="name"/>
107+
<element type="string" name="ortsrat"/>
108+
</sequence>
109+
</extension>
110+
</complexContent>
111+
</complexType>
112+
</schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Content-Length: 422
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
6+
</schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Content-Length: 1841
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
6+
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
7+
<complexType name="as_areasType">
8+
<complexContent>
9+
<extension base="gml:AbstractFeatureType">
10+
<sequence>
11+
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
12+
<element type="long" name="fid"/>
13+
<element type="int" name="gid"/>
14+
<element type="string" name="datum"/>
15+
<element type="string" name="bearbeiter"/>
16+
<element type="string" name="veranstaltung"/>
17+
<element type="string" name="beschriftung"/>
18+
<element type="string" name="name"/>
19+
<element type="string" name="flaechentyp"/>
20+
<element type="string" name="farbe"/>
21+
<element type="string" name="schraff_width"/>
22+
<element type="string" name="schraff_width_prt"/>
23+
<element type="string" name="schraff_size"/>
24+
<element type="string" name="schraff_size_prt"/>
25+
<element type="string" name="schraff_winkel"/>
26+
<element type="string" name="umrissfarbe"/>
27+
<element type="string" name="umrisstyp"/>
28+
<element type="string" name="umrissstaerke"/>
29+
<element type="string" name="umrissstaerke_prt"/>
30+
<element type="decimal" name="umfang"/>
31+
<element type="decimal" name="flaeche"/>
32+
<element type="string" name="bemerkung"/>
33+
<element type="string" name="last_change"/>
34+
</sequence>
35+
</extension>
36+
</complexContent>
37+
</complexType>
38+
</schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
Content-Length: 4895
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
6+
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
7+
<complexType name="as_areasType">
8+
<complexContent>
9+
<extension base="gml:AbstractFeatureType">
10+
<sequence>
11+
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
12+
<element type="long" name="fid"/>
13+
<element type="int" name="gid"/>
14+
<element type="string" name="datum"/>
15+
<element type="string" name="bearbeiter"/>
16+
<element type="string" name="veranstaltung"/>
17+
<element type="string" name="beschriftung"/>
18+
<element type="string" name="name"/>
19+
<element type="string" name="flaechentyp"/>
20+
<element type="string" name="farbe"/>
21+
<element type="string" name="schraff_width"/>
22+
<element type="string" name="schraff_width_prt"/>
23+
<element type="string" name="schraff_size"/>
24+
<element type="string" name="schraff_size_prt"/>
25+
<element type="string" name="schraff_winkel"/>
26+
<element type="string" name="umrissfarbe"/>
27+
<element type="string" name="umrisstyp"/>
28+
<element type="string" name="umrissstaerke"/>
29+
<element type="string" name="umrissstaerke_prt"/>
30+
<element type="decimal" name="umfang"/>
31+
<element type="decimal" name="flaeche"/>
32+
<element type="string" name="bemerkung"/>
33+
<element type="string" name="last_change"/>
34+
</sequence>
35+
</extension>
36+
</complexContent>
37+
</complexType>
38+
<element type="qgs:as_symbolsType" name="as_symbols" substitutionGroup="gml:_Feature"/>
39+
<complexType name="as_symbolsType">
40+
<complexContent>
41+
<extension base="gml:AbstractFeatureType">
42+
<sequence>
43+
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
44+
<element type="long" name="fid"/>
45+
<element type="int" name="gid"/>
46+
<element type="string" name="datum"/>
47+
<element type="string" name="bearbeiter"/>
48+
<element type="string" name="veranstaltung"/>
49+
<element type="string" name="beschriftung"/>
50+
<element type="string" name="name"/>
51+
<element type="string" name="form"/>
52+
<element type="string" name="groesse"/>
53+
<element type="string" name="groesse_red"/>
54+
<element type="string" name="winkel"/>
55+
<element type="string" name="farbe"/>
56+
<element type="string" name="bemerkung"/>
57+
<element type="string" name="last_change"/>
58+
</sequence>
59+
</extension>
60+
</complexContent>
61+
</complexType>
62+
<element type="qgs:cdb_labelsType" name="cdb_labels" substitutionGroup="gml:_Feature"/>
63+
<complexType name="cdb_labelsType">
64+
<complexContent>
65+
<extension base="gml:AbstractFeatureType">
66+
<sequence>
67+
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
68+
<element type="long" name="fid"/>
69+
<element type="decimal" name="AREA"/>
70+
<element type="decimal" name="PERIMETER"/>
71+
<element type="int" name="STADTTEILE"/>
72+
<element type="int" name="STADTTEI_1"/>
73+
<element type="int" name="S_A_"/>
74+
<element type="int" name="S_A_ID"/>
75+
<element type="string" name="O_NAME"/>
76+
<element type="string" name="ORTSTEIL"/>
77+
<element type="string" name="STADTTEIL"/>
78+
<element type="string" name="OT_SCHL"/>
79+
<element type="string" name="GEM_SCHL"/>
80+
<element type="decimal" name="ZVS"/>
81+
<element type="string" name="NAME"/>
82+
<element type="string" name="PLZ"/>
83+
<element type="string" name="KERNSTADT_"/>
84+
<element type="string" name="ORTSRATSBE"/>
85+
<element type="decimal" name="PLG_KITA"/>
86+
<element type="decimal" name="PLG_BERATU"/>
87+
<element type="decimal" name="PLG_JUFOE"/>
88+
<element type="decimal" name="VERFLECHTU"/>
89+
<element type="decimal" name="FUNKTIONSB"/>
90+
<element type="string" name="T_DATUM"/>
91+
<element type="string" name="Impfbez_Nr"/>
92+
<element type="string" name="Impfzentru"/>
93+
</sequence>
94+
</extension>
95+
</complexContent>
96+
</complexType>
97+
<element type="qgs:cdb_linesType" name="cdb_lines" substitutionGroup="gml:_Feature"/>
98+
<complexType name="cdb_linesType">
99+
<complexContent>
100+
<extension base="gml:AbstractFeatureType">
101+
<sequence>
102+
<element maxOccurs="1" type="gml:PolygonPropertyType" minOccurs="0" name="geometry"/>
103+
<element type="long" name="fid"/>
104+
<element type="int" name="id"/>
105+
<element type="string" name="typ"/>
106+
<element type="string" name="name"/>
107+
<element type="string" name="ortsrat"/>
108+
</sequence>
109+
</extension>
110+
</complexContent>
111+
</complexType>
112+
</schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Content-Length: 423
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<schema xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.qgis.org/gml" xmlns:qgs="http://www.qgis.org/gml" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
5+
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
6+
</schema>

0 commit comments

Comments
 (0)