Skip to content
Permalink
Browse files

Merge pull request #6856 from arnaud-morvan/server_fix_wfs_bbox_srs

Fix BBOX CRS in WFS GetFeature
  • Loading branch information
rldhont committed May 2, 2018
2 parents f73bf4f + 60dc78a commit 73ad80f3e8a8842cf6b5934a22213e98e0df2f2f
Showing with 24 additions and 7 deletions.
  1. +17 −5 src/server/services/wfs/qgswfsgetfeature.cpp
  2. +7 −2 tests/src/python/test_qgsserver_wfs.py
@@ -336,11 +336,6 @@ namespace QgsWfs
requestPrecision = QgsServerProjectUtils::wfsLayerPrecision( *project, vlayer->id() );
}

if ( onlyOneLayer && !featureRequest.filterRect().isEmpty() )
{
requestRect = featureRequest.filterRect();
}

if ( aRequest.maxFeatures > 0 )
{
featureRequest.setLimit( aRequest.maxFeatures + aRequest.startIndex - sentFeatures );
@@ -363,6 +358,23 @@ namespace QgsWfs
outputCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( query.srsName );
}

if ( onlyOneLayer && !featureRequest.filterRect().isEmpty() )
{
Q_NOWARN_DEPRECATED_PUSH
QgsCoordinateTransform transform( outputCrs, requestCrs );
Q_NOWARN_DEPRECATED_POP
try
{
featureRequest.setFilterRect( transform.transform( featureRequest.filterRect() ) );
}
catch ( QgsException &cse )
{
Q_UNUSED( cse );
}

requestRect = featureRequest.filterRect();
}

// Iterate through features
QgsFeatureIterator fit = vlayer->getFeatures( featureRequest );

@@ -219,8 +219,8 @@ def test_getfeature_post(self):
<ogc:BBOX>
<ogc:PropertyName>geometry</ogc:PropertyName>
<gml:Envelope xmlns:gml="http://www.opengis.net/gml">
<gml:lowerCorner>8 44</gml:lowerCorner>
<gml:upperCorner>9 45</gml:upperCorner>
<gml:lowerCorner>890555.92634619 5465442.18332275</gml:lowerCorner>
<gml:upperCorner>1001875.41713946 5621521.48619207</gml:upperCorner>
</gml:Envelope>
</ogc:BBOX>
</ogc:Filter>
@@ -268,6 +268,11 @@ def test_getFeatureBBOX(self):
self.wfs_request_compare("GetFeature", '1.1.0', "SRSNAME=EPSG:4326&TYPENAME=testlayer&RESULTTYPE=hits&BBOX=913144,5605992,913303,5606048,EPSG:3857", 'wfs_getFeature_1_1_0_epsgbbox_3_feature_3857')
self.wfs_request_compare("GetFeature", '1.1.0', "SRSNAME=EPSG:4326&TYPENAME=testlayer&RESULTTYPE=hits&BBOX=913206,5606024,913213,5606026,EPSG:3857", 'wfs_getFeature_1_1_0_epsgbbox_1_feature_3857')

self.wfs_request_compare("GetFeature", '1.0.0', "SRSNAME=EPSG:3857&TYPENAME=testlayer&RESULTTYPE=hits&BBOX=913144,5605992,913303,5606048,EPSG:3857", 'wfs_getFeature_1_0_0_epsgbbox_3_feature_3857')
self.wfs_request_compare("GetFeature", '1.0.0', "SRSNAME=EPSG:3857&TYPENAME=testlayer&RESULTTYPE=hits&BBOX=913206,5606024,913213,5606026,EPSG:3857", 'wfs_getFeature_1_0_0_epsgbbox_1_feature_3857')
self.wfs_request_compare("GetFeature", '1.1.0', "SRSNAME=EPSG:3857&TYPENAME=testlayer&RESULTTYPE=hits&BBOX=913144,5605992,913303,5606048,EPSG:3857", 'wfs_getFeature_1_1_0_epsgbbox_3_feature_3857')
self.wfs_request_compare("GetFeature", '1.1.0', "SRSNAME=EPSG:3857&TYPENAME=testlayer&RESULTTYPE=hits&BBOX=913206,5606024,913213,5606026,EPSG:3857", 'wfs_getFeature_1_1_0_epsgbbox_1_feature_3857')

def test_getFeatureFeatureId(self):
"""Test GetFeature with featureid"""
self.wfs_request_compare("GetFeature", '1.0.0', "SRSNAME=EPSG:4326&TYPENAME=testlayer&FEATUREID=testlayer.0", 'wfs_getFeature_1_0_0_featureid_0')

0 comments on commit 73ad80f

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