Skip to content

Commit

Permalink
implement some workaround to support legacy WMS (fixes #3853)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 1, 2011
1 parent c8dd587 commit df8bd2d
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -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
{
Expand Down Expand Up @@ -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" )
{
Expand Down

0 comments on commit df8bd2d

Please sign in to comment.