Skip to content
Permalink
Browse files
Change order of x- and y- coordinates in WMS bbox parameter for 1.3 a…
…nd for geographic coordinate systems. This is as described in the WMS1.3 specifications (for WMS1.1.1, there is no such change)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8410 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 7, 2008
1 parent be36ee5 commit 106796560e8ab328548ddaf59500b4684944e903
Showing with 37 additions and 6 deletions.
  1. +37 −6 src/providers/wms/qgswmsprovider.cpp
@@ -334,13 +334,44 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi

// Bounding box in WMS format
QString bbox;

//according to the WMS spec for 1.3, the order of x - and y - coordinates is inverted for geographical CRS
bool changeXY = false;
if(mCapabilities.version == "1.3.0" || mCapabilities.version == "1.3")
{
//create CRS from string
bool conversionOk;
int epsgNr = imageCrs.section(":", 1, 1).toInt(&conversionOk);
if(conversionOk)
{
QgsSpatialRefSys theSrs;
theSrs.createFromEpsg(epsgNr);
if(theSrs.geographicFlag())
{
changeXY = true;
}
}
}


// Warning: does not work with scientific notation
bbox = QString("%1,%2,%3,%4").
arg(viewExtent.xMin(),0,'f').
arg(viewExtent.yMin(),0,'f').
arg(viewExtent.xMax(),0,'f').
arg(viewExtent.yMax(),0,'f');

if(changeXY)
{
bbox = QString("%1,%2,%3,%4").
arg(viewExtent.yMin(),0,'f').
arg(viewExtent.xMin(),0,'f').
arg(viewExtent.yMax(),0,'f').
arg(viewExtent.xMax(),0,'f');
}
else
{
bbox = QString("%1,%2,%3,%4").
arg(viewExtent.xMin(),0,'f').
arg(viewExtent.yMin(),0,'f').
arg(viewExtent.xMax(),0,'f').
arg(viewExtent.yMax(),0,'f');
}

// Width in WMS format
QString width;
width = width.setNum(pixelWidth);

0 comments on commit 1067965

Please sign in to comment.