Skip to content
Permalink
Browse files

Merge pull request #8948 from elpaso/bugfix-20198-server-DescribeFeat…

…ureType-typename

Fix server WFS TYPENAME filter in describeFeatureType
  • Loading branch information
elpaso committed Jan 23, 2019
2 parents de29767 + 59fd8df commit 49096431bc0e17b8a8cd5a9ab1c64e45a8fc1295
@@ -130,19 +130,7 @@ namespace QgsWfs
}
else
{
QString typeNames = request.parameter( QStringLiteral( "TYPENAME" ) );
if ( !typeNames.isEmpty() )
{
QStringList typeNameSplit = typeNames.split( ',' );
for ( int i = 0; i < typeNameSplit.size(); ++i )
{
QString typeName = typeNameSplit.at( i ).trimmed();
if ( typeName.contains( ':' ) )
typeNameList << typeName.section( ':', 1, 1 );
else
typeNameList << typeName;
}
}
typeNameList = wfsParameters.typeNames();
}

QStringList wfsLayerIds = QgsServerProjectUtils::wfsLayerIds( *project );
@@ -44,10 +44,10 @@ class TestQgsServerWFS(QgsServerTestBase):
"""QGIS Server WFS Tests"""

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

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

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):
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')
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')

def test_describeFeatureType(self):
"""Test DescribeFeatureType with TYPENAME filters"""

project_file = "test_project_wms_grouped_layers.qgs"
self.wfs_request_compare("DescribeFeatureType", '1.0.0', "TYPENAME=as_areas&", 'wfs_describeFeatureType_1_0_0_typename_as_areas', project_file=project_file)
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "TYPENAME=as_areas&", 'wfs_describeFeatureType_1_1_0_typename_as_areas', project_file=project_file)
self.wfs_request_compare("DescribeFeatureType", '1.0.0', "", 'wfs_describeFeatureType_1_0_0_typename_empty', project_file=project_file)
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "", 'wfs_describeFeatureType_1_1_0_typename_empty', project_file=project_file)
self.wfs_request_compare("DescribeFeatureType", '1.0.0', "TYPENAME=does_not_exist&", 'wfs_describeFeatureType_1_0_0_typename_wrong', project_file=project_file)
self.wfs_request_compare("DescribeFeatureType", '1.1.0', "TYPENAME=does_not_exist&", 'wfs_describeFeatureType_1_1_0_typename_wrong', project_file=project_file)


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

Large diffs are not rendered by default.

@@ -0,0 +1,38 @@
Content-Length: 1840
Content-Type: text/xml; charset=utf-8

<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">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
<complexType name="as_areasType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="gid"/>
<element type="string" name="datum"/>
<element type="string" name="bearbeiter"/>
<element type="string" name="veranstaltung"/>
<element type="string" name="beschriftung"/>
<element type="string" name="name"/>
<element type="string" name="flaechentyp"/>
<element type="string" name="farbe"/>
<element type="string" name="schraff_width"/>
<element type="string" name="schraff_width_prt"/>
<element type="string" name="schraff_size"/>
<element type="string" name="schraff_size_prt"/>
<element type="string" name="schraff_winkel"/>
<element type="string" name="umrissfarbe"/>
<element type="string" name="umrisstyp"/>
<element type="string" name="umrissstaerke"/>
<element type="string" name="umrissstaerke_prt"/>
<element type="decimal" name="umfang"/>
<element type="decimal" name="flaeche"/>
<element type="string" name="bemerkung"/>
<element type="string" name="last_change"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
@@ -0,0 +1,112 @@
Content-Length: 4894
Content-Type: text/xml; charset=utf-8

<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">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
<complexType name="as_areasType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="gid"/>
<element type="string" name="datum"/>
<element type="string" name="bearbeiter"/>
<element type="string" name="veranstaltung"/>
<element type="string" name="beschriftung"/>
<element type="string" name="name"/>
<element type="string" name="flaechentyp"/>
<element type="string" name="farbe"/>
<element type="string" name="schraff_width"/>
<element type="string" name="schraff_width_prt"/>
<element type="string" name="schraff_size"/>
<element type="string" name="schraff_size_prt"/>
<element type="string" name="schraff_winkel"/>
<element type="string" name="umrissfarbe"/>
<element type="string" name="umrisstyp"/>
<element type="string" name="umrissstaerke"/>
<element type="string" name="umrissstaerke_prt"/>
<element type="decimal" name="umfang"/>
<element type="decimal" name="flaeche"/>
<element type="string" name="bemerkung"/>
<element type="string" name="last_change"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element type="qgs:as_symbolsType" name="as_symbols" substitutionGroup="gml:_Feature"/>
<complexType name="as_symbolsType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="gid"/>
<element type="string" name="datum"/>
<element type="string" name="bearbeiter"/>
<element type="string" name="veranstaltung"/>
<element type="string" name="beschriftung"/>
<element type="string" name="name"/>
<element type="string" name="form"/>
<element type="string" name="groesse"/>
<element type="string" name="groesse_red"/>
<element type="string" name="winkel"/>
<element type="string" name="farbe"/>
<element type="string" name="bemerkung"/>
<element type="string" name="last_change"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element type="qgs:cdb_labelsType" name="cdb_labels" substitutionGroup="gml:_Feature"/>
<complexType name="cdb_labelsType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="decimal" name="AREA"/>
<element type="decimal" name="PERIMETER"/>
<element type="int" name="STADTTEILE"/>
<element type="int" name="STADTTEI_1"/>
<element type="int" name="S_A_"/>
<element type="int" name="S_A_ID"/>
<element type="string" name="O_NAME"/>
<element type="string" name="ORTSTEIL"/>
<element type="string" name="STADTTEIL"/>
<element type="string" name="OT_SCHL"/>
<element type="string" name="GEM_SCHL"/>
<element type="decimal" name="ZVS"/>
<element type="string" name="NAME"/>
<element type="string" name="PLZ"/>
<element type="string" name="KERNSTADT_"/>
<element type="string" name="ORTSRATSBE"/>
<element type="decimal" name="PLG_KITA"/>
<element type="decimal" name="PLG_BERATU"/>
<element type="decimal" name="PLG_JUFOE"/>
<element type="decimal" name="VERFLECHTU"/>
<element type="decimal" name="FUNKTIONSB"/>
<element type="string" name="T_DATUM"/>
<element type="string" name="Impfbez_Nr"/>
<element type="string" name="Impfzentru"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element type="qgs:cdb_linesType" name="cdb_lines" substitutionGroup="gml:_Feature"/>
<complexType name="cdb_linesType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:PolygonPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="id"/>
<element type="string" name="typ"/>
<element type="string" name="name"/>
<element type="string" name="ortsrat"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
@@ -0,0 +1,6 @@
Content-Length: 422
Content-Type: text/xml; charset=utf-8

<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">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
</schema>
@@ -0,0 +1,38 @@
Content-Length: 1841
Content-Type: text/xml; charset=utf-8

<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">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
<complexType name="as_areasType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="gid"/>
<element type="string" name="datum"/>
<element type="string" name="bearbeiter"/>
<element type="string" name="veranstaltung"/>
<element type="string" name="beschriftung"/>
<element type="string" name="name"/>
<element type="string" name="flaechentyp"/>
<element type="string" name="farbe"/>
<element type="string" name="schraff_width"/>
<element type="string" name="schraff_width_prt"/>
<element type="string" name="schraff_size"/>
<element type="string" name="schraff_size_prt"/>
<element type="string" name="schraff_winkel"/>
<element type="string" name="umrissfarbe"/>
<element type="string" name="umrisstyp"/>
<element type="string" name="umrissstaerke"/>
<element type="string" name="umrissstaerke_prt"/>
<element type="decimal" name="umfang"/>
<element type="decimal" name="flaeche"/>
<element type="string" name="bemerkung"/>
<element type="string" name="last_change"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
@@ -0,0 +1,112 @@
Content-Length: 4895
Content-Type: text/xml; charset=utf-8

<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">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
<element type="qgs:as_areasType" name="as_areas" substitutionGroup="gml:_Feature"/>
<complexType name="as_areasType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:MultiPolygonPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="gid"/>
<element type="string" name="datum"/>
<element type="string" name="bearbeiter"/>
<element type="string" name="veranstaltung"/>
<element type="string" name="beschriftung"/>
<element type="string" name="name"/>
<element type="string" name="flaechentyp"/>
<element type="string" name="farbe"/>
<element type="string" name="schraff_width"/>
<element type="string" name="schraff_width_prt"/>
<element type="string" name="schraff_size"/>
<element type="string" name="schraff_size_prt"/>
<element type="string" name="schraff_winkel"/>
<element type="string" name="umrissfarbe"/>
<element type="string" name="umrisstyp"/>
<element type="string" name="umrissstaerke"/>
<element type="string" name="umrissstaerke_prt"/>
<element type="decimal" name="umfang"/>
<element type="decimal" name="flaeche"/>
<element type="string" name="bemerkung"/>
<element type="string" name="last_change"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element type="qgs:as_symbolsType" name="as_symbols" substitutionGroup="gml:_Feature"/>
<complexType name="as_symbolsType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="gid"/>
<element type="string" name="datum"/>
<element type="string" name="bearbeiter"/>
<element type="string" name="veranstaltung"/>
<element type="string" name="beschriftung"/>
<element type="string" name="name"/>
<element type="string" name="form"/>
<element type="string" name="groesse"/>
<element type="string" name="groesse_red"/>
<element type="string" name="winkel"/>
<element type="string" name="farbe"/>
<element type="string" name="bemerkung"/>
<element type="string" name="last_change"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element type="qgs:cdb_labelsType" name="cdb_labels" substitutionGroup="gml:_Feature"/>
<complexType name="cdb_labelsType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:PointPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="decimal" name="AREA"/>
<element type="decimal" name="PERIMETER"/>
<element type="int" name="STADTTEILE"/>
<element type="int" name="STADTTEI_1"/>
<element type="int" name="S_A_"/>
<element type="int" name="S_A_ID"/>
<element type="string" name="O_NAME"/>
<element type="string" name="ORTSTEIL"/>
<element type="string" name="STADTTEIL"/>
<element type="string" name="OT_SCHL"/>
<element type="string" name="GEM_SCHL"/>
<element type="decimal" name="ZVS"/>
<element type="string" name="NAME"/>
<element type="string" name="PLZ"/>
<element type="string" name="KERNSTADT_"/>
<element type="string" name="ORTSRATSBE"/>
<element type="decimal" name="PLG_KITA"/>
<element type="decimal" name="PLG_BERATU"/>
<element type="decimal" name="PLG_JUFOE"/>
<element type="decimal" name="VERFLECHTU"/>
<element type="decimal" name="FUNKTIONSB"/>
<element type="string" name="T_DATUM"/>
<element type="string" name="Impfbez_Nr"/>
<element type="string" name="Impfzentru"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element type="qgs:cdb_linesType" name="cdb_lines" substitutionGroup="gml:_Feature"/>
<complexType name="cdb_linesType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element maxOccurs="1" type="gml:PolygonPropertyType" minOccurs="0" name="geometry"/>
<element type="long" name="fid"/>
<element type="int" name="id"/>
<element type="string" name="typ"/>
<element type="string" name="name"/>
<element type="string" name="ortsrat"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
@@ -0,0 +1,6 @@
Content-Length: 423
Content-Type: text/xml; charset=utf-8

<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">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
</schema>

0 comments on commit 4909643

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