Skip to content

Commit

Permalink
Merge pull request #32596 from elpaso/server-oapif-fix-items-crs-3_10
Browse files Browse the repository at this point in the history
Fix server OAPIF crs transformation on items
  • Loading branch information
elpaso committed Nov 12, 2019
2 parents e61d985 + ff342fd commit 051f8c5
Show file tree
Hide file tree
Showing 6 changed files with 2,017 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/server/services/wfs3/qgswfs3handlers.cpp
Expand Up @@ -1077,7 +1077,7 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c
QgsJsonExporter exporter { mapLayer };
exporter.setAttributes( featureRequest.subsetOfAttributes() );
exporter.setAttributeDisplayName( true );
exporter.setSourceCrs( mapLayer->crs() );
exporter.setTransformGeometries( false );
QgsFeatureList featureList;
QgsFeatureIterator features { mapLayer->getFeatures( featureRequest ) };
QgsFeature feat;
Expand Down
16 changes: 16 additions & 0 deletions tests/src/python/test_qgsserver_api.py
Expand Up @@ -372,6 +372,22 @@ def test_wfs3_collection_items_crs(self):
request = QgsBufferServerRequest('http://server.qgis.org/wfs3/collections/testlayer%20èé/items?crs={}'.format(encoded_crs))
self.compareApi(request, project, 'test_wfs3_collections_items_testlayer_èé_crs_3857.json')

def test_wfs3_collection_items_as_areas_crs_4326(self):
"""Test WFS3 API items with CRS"""
project = QgsProject()
project.read(unitTestDataPath('qgis_server') + '/test_project_wms_grouped_nested_layers.qgs')
encoded_crs = parse.quote('http://www.opengis.net/def/crs/EPSG/9.6.2/4326', safe='')
request = QgsBufferServerRequest('http://server.qgis.org/wfs3/collections/as-areas-short-name/items?crs={}'.format(encoded_crs))
self.compareApi(request, project, 'test_wfs3_collections_items_as-areas-short-name_4326.json')

def test_wfs3_collection_items_as_areas_crs_3857(self):
"""Test WFS3 API items with CRS"""
project = QgsProject()
project.read(unitTestDataPath('qgis_server') + '/test_project_wms_grouped_nested_layers.qgs')
encoded_crs = parse.quote('http://www.opengis.net/def/crs/EPSG/9.6.2/3857', safe='')
request = QgsBufferServerRequest('http://server.qgis.org/wfs3/collections/as-areas-short-name/items?crs={}'.format(encoded_crs))
self.compareApi(request, project, 'test_wfs3_collections_items_as-areas-short-name_3857.json')

def test_invalid_args(self):
"""Test wrong args"""
project = QgsProject()
Expand Down
Expand Up @@ -46,6 +46,6 @@ Content-Type: application/json
"type": "text/html"
}
],
"timeStamp": "2019-10-16T13:53:56Z",
"timeStamp": "2019-11-02T15:56:20Z",
"title": "A test vector layer èé"
}

0 comments on commit 051f8c5

Please sign in to comment.