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 585b82e commit 011109a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/server/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1804,9 +1804,6 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const
throw QgsMapServiceException( "InvalidCRS", "Could not create output CRS" );
return 5;
}
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 @@ -1819,6 +1816,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 011109a

Please sign in to comment.