From 36ebf1c5698b5cf2a14056f0b5845c8edc72af75 Mon Sep 17 00:00:00 2001 From: rldhont Date: Tue, 13 Oct 2015 19:31:57 +0200 Subject: [PATCH] [BUGFIX][QGIS Server] Add layer coordinate transforms before setting destination CRS If the layer_coordinate_transform_info child of mapcanvas has not been well saved, the destinationCrs is not well applied and we get a blank image. To resolve this issue, we just have to add layer coordinate transforms to the map renderer before setting the destination CRS. --- src/server/qgswmsserver.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/qgswmsserver.cpp b/src/server/qgswmsserver.cpp index 9e3bf45aa45a..f8c06b6c761d 100644 --- a/src/server/qgswmsserver.cpp +++ b/src/server/qgswmsserver.cpp @@ -1899,9 +1899,6 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const QgsDebugMsg( "Error, could not create output CRS from EPSG" ); throw QgsMapServiceException( "InvalidCRS", "Could not create output CRS" ); } - mMapRenderer->setDestinationCrs( outputCRS ); - mMapRenderer->setProjectionsEnabled( true ); - mapUnits = outputCRS.mapUnits(); //read layer coordinate transforms from project file (e.g. ct with special datum shift) if ( mConfigParser ) @@ -1914,6 +1911,11 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const mMapRenderer->addLayerCoordinateTransform( ltIt->first, t.srcAuthId, t.destAuthId, t.srcDatumTransform, t.destDatumTransform ); } } + + //then set destinationCrs + mMapRenderer->setDestinationCrs( outputCRS ); + mMapRenderer->setProjectionsEnabled( true ); + mapUnits = outputCRS.mapUnits(); } mMapRenderer->setMapUnits( mapUnits );