Skip to content

Commit df8bd2d

Browse files
committed
implement some workaround to support legacy WMS (fixes #3853)
1 parent c8dd587 commit df8bd2d

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/providers/wms/qgswmsprovider.cpp

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,25 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
17241724
e1.attribute( "maxx" ).toDouble(),
17251725
e1.attribute( "maxy" ).toDouble()
17261726
);
1727+
1728+
if ( e1.hasAttribute( "SRS" ) && e1.attribute( "SRS" ) != DEFAULT_LATLON_CRS )
1729+
{
1730+
try
1731+
{
1732+
QgsCoordinateReferenceSystem src;
1733+
src.createFromOgcWmsCrs( e1.attribute( "SRS" ) );
1734+
1735+
QgsCoordinateReferenceSystem dst;
1736+
dst.createFromOgcWmsCrs( DEFAULT_LATLON_CRS );
1737+
1738+
QgsCoordinateTransform ct( src, dst );
1739+
layerProperty.ex_GeographicBoundingBox = ct.transformBoundingBox( layerProperty.ex_GeographicBoundingBox );
1740+
}
1741+
catch ( QgsCsException &cse )
1742+
{
1743+
Q_UNUSED( cse );
1744+
}
1745+
}
17271746
}
17281747
else if ( e1.tagName() == "EX_GeographicBoundingBox" ) //for WMS 1.3
17291748
{
@@ -1751,8 +1770,19 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
17511770
e1.attribute( "maxx" ).toDouble(),
17521771
e1.attribute( "maxy" ).toDouble()
17531772
);
1754-
bbox.crs = e1.attribute( "CRS" );
1755-
layerProperty.boundingBox.push_back( bbox );
1773+
if ( e1.hasAttribute( "CRS" ) || e1.hasAttribute( "SRS" ) )
1774+
{
1775+
if ( e1.hasAttribute( "CRS" ) )
1776+
bbox.crs = e1.attribute( "CRS" );
1777+
else if ( e1.hasAttribute( "SRS" ) )
1778+
bbox.crs = e1.attribute( "SRS" );
1779+
1780+
layerProperty.boundingBox.push_back( bbox );
1781+
}
1782+
else
1783+
{
1784+
QgsDebugMsg( "CRS/SRS attribute note found in BoundingBox" );
1785+
}
17561786
}
17571787
else if ( e1.tagName() == "Dimension" )
17581788
{

0 commit comments

Comments
 (0)