From df8bd2d79b3f588d7cea31444599bd8df24d6858 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Mon, 30 May 2011 00:21:14 +0200 Subject: [PATCH] implement some workaround to support legacy WMS (fixes #3853) --- src/providers/wms/qgswmsprovider.cpp | 34 ++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index c55533918c6..b18c7fa67b6 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -1724,6 +1724,25 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay e1.attribute( "maxx" ).toDouble(), e1.attribute( "maxy" ).toDouble() ); + + if ( e1.hasAttribute( "SRS" ) && e1.attribute( "SRS" ) != DEFAULT_LATLON_CRS ) + { + try + { + QgsCoordinateReferenceSystem src; + src.createFromOgcWmsCrs( e1.attribute( "SRS" ) ); + + QgsCoordinateReferenceSystem dst; + dst.createFromOgcWmsCrs( DEFAULT_LATLON_CRS ); + + QgsCoordinateTransform ct( src, dst ); + layerProperty.ex_GeographicBoundingBox = ct.transformBoundingBox( layerProperty.ex_GeographicBoundingBox ); + } + catch ( QgsCsException &cse ) + { + Q_UNUSED( cse ); + } + } } else if ( e1.tagName() == "EX_GeographicBoundingBox" ) //for WMS 1.3 { @@ -1751,8 +1770,19 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay e1.attribute( "maxx" ).toDouble(), e1.attribute( "maxy" ).toDouble() ); - bbox.crs = e1.attribute( "CRS" ); - layerProperty.boundingBox.push_back( bbox ); + if ( e1.hasAttribute( "CRS" ) || e1.hasAttribute( "SRS" ) ) + { + if ( e1.hasAttribute( "CRS" ) ) + bbox.crs = e1.attribute( "CRS" ); + else if ( e1.hasAttribute( "SRS" ) ) + bbox.crs = e1.attribute( "SRS" ); + + layerProperty.boundingBox.push_back( bbox ); + } + else + { + QgsDebugMsg( "CRS/SRS attribute note found in BoundingBox" ); + } } else if ( e1.tagName() == "Dimension" ) {