Skip to content

Commit

Permalink
Fix server OAPIF crs tranformation on items
Browse files Browse the repository at this point in the history
fixes an unreported issue when serving items not in
4326.
  • Loading branch information
elpaso committed Nov 2, 2019
1 parent c86ed78 commit 7d2000b
Show file tree
Hide file tree
Showing 6 changed files with 2,017 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/server/services/wfs3/qgswfs3handlers.cpp
Expand Up @@ -1150,6 +1150,7 @@ void QgsWfs3CollectionsItemsHandler::handleRequest( const QgsServerApiContext &c
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 @@ -434,6 +434,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 @@ -50,6 +50,6 @@ Content-Type: application/json
"type": "text/html"
}
],
"timeStamp": "2019-07-05T12:27:07Z",
"timeStamp": "2019-11-02T15:56:20Z",
"title": "A test vector layer èé"
}

0 comments on commit 7d2000b

Please sign in to comment.