File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1916,6 +1916,7 @@ bool QgsWmsProvider::calculateExtent()
1916
1916
mCoordinateTransform = new QgsCoordinateTransform (qgisSrsSource, qgisSrsDest);
1917
1917
}
1918
1918
1919
+ bool firstLayer = true ; // flag to know if a layer is the first to be successfully transformed
1919
1920
for ( QStringList::Iterator it = activeSubLayers.begin ();
1920
1921
it != activeSubLayers.end ();
1921
1922
++it )
@@ -1925,21 +1926,26 @@ bool QgsWmsProvider::calculateExtent()
1925
1926
QgsRect extent = extentForLayer.find ( *it )->second ;
1926
1927
1927
1928
// Convert to the user's CRS as required
1928
- extent =
1929
- mCoordinateTransform ->transformBoundingBox (
1930
- extent,
1931
- QgsCoordinateTransform::FORWARD
1932
- );
1929
+ try
1930
+ {
1931
+ extent = mCoordinateTransform ->transformBoundingBox (extent, QgsCoordinateTransform::FORWARD);
1932
+ }
1933
+ catch (QgsCsException &cse)
1934
+ {
1935
+ continue ; // ignore extents of layers which cannot be transformed info the required CRS
1936
+ }
1933
1937
1934
1938
// add to the combined extent of all the active sublayers
1935
- if ( it == activeSubLayers. begin () )
1939
+ if (firstLayer )
1936
1940
{
1937
1941
layerExtent = extent;
1938
1942
}
1939
1943
else
1940
1944
{
1941
1945
layerExtent.combineExtentWith ( &extent );
1942
1946
}
1947
+
1948
+ firstLayer = false ;
1943
1949
1944
1950
#ifdef QGISDEBUG
1945
1951
std::cout << " QgsWmsProvider::calculateExtent: combined extent is '" <<
You can’t perform that action at this time.
0 commit comments