Skip to content
Permalink
Browse files

[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.
  • Loading branch information
rldhont committed Oct 13, 2015
1 parent 3d1c714 commit 36ebf1c5698b5cf2a14056f0b5845c8edc72af75
Showing with 5 additions and 3 deletions.
  1. +5 −3 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 );

0 comments on commit 36ebf1c

Please sign in to comment.
You can’t perform that action at this time.