You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WFS Provider] Implement workarounds to better behave when extent reported by capabilities is wrong
Some servers like http://geodata.nationaalgeoregister.nl/bag/wfs report wrong layer
extent in their GetCapabilities response.
This commit implements a work around :
- in the 'Request only features intersecting extent' mode, if no feature is returned
in a BBOX enclosing the GetCapabilities extent, then query a single feature to
initialize the extent. The user will then to zoom again on layer and zoom out.
- in the other mode, the extent is updated with the feature geometry extent as soon
as features come from the server, and the user can zoom on layer regularly to se
it updated.
QgsDebugMsg( "Capability extent is probably wrong. Starting a new request with one feature limit to get at least one feature" );
1007
+
mTryFetchingOneFeature = true;
1008
+
QgsWFSSingleFeatureRequest request( this );
1009
+
mComputedExtent = request.getExtent();
1010
+
if ( !mComputedExtent.isNull() )
1011
+
{
1012
+
// Grow the extent by ~ 50 km (completely arbitrary number if you wonder!)
1013
+
// so that it is sufficiently zoomed out
1014
+
if ( mSourceCRS.mapUnits() == QGis::Meters )
1015
+
mComputedExtent.grow( 50. * 1000. );
1016
+
elseif ( mSourceCRS.mapUnits() == QGis::Degrees )
1017
+
mComputedExtent.grow( 50. / 110 );
1018
+
QgsMessageLog::logMessage( tr( "Layer extent reported by the server is not correct. You may need to zoom on layer and then zoom out to see all fetchures" ), tr( "WFS" ) );
1019
+
}
1020
+
mMutex.unlock();
1021
+
if ( !mComputedExtent.isNull() )
1022
+
{
1023
+
emit extentUpdated();
1024
+
}
1025
+
mMutex.lock();
1026
+
return;
1027
+
}
1028
+
973
1029
// Arbitrary threshold to avoid the cache of BBOX to grow out of control.
974
1030
// Note: we could be smarter and keep some BBOXes, but the saturation is
975
1031
// unlikely to happen in practice, so just clear everything.
@@ -1099,6 +1155,41 @@ int QgsWFSSharedData::getFeatureCount( bool issueRequestIfNeeded )
0 commit comments