Skip to content

Commit

Permalink
[BUGFIX][QGIS Server] Add layer coordinate transforms before setting …
Browse files Browse the repository at this point in the history
…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 36ebf1c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/server/qgswmsserver.cpp
Expand Up @@ -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 )
Expand All @@ -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 );

Expand Down

0 comments on commit 36ebf1c

Please sign in to comment.