Skip to content

Commit 36ebf1c

Browse files
committed
[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.
1 parent 3d1c714 commit 36ebf1c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/server/qgswmsserver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,9 +1899,6 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const
18991899
QgsDebugMsg( "Error, could not create output CRS from EPSG" );
19001900
throw QgsMapServiceException( "InvalidCRS", "Could not create output CRS" );
19011901
}
1902-
mMapRenderer->setDestinationCrs( outputCRS );
1903-
mMapRenderer->setProjectionsEnabled( true );
1904-
mapUnits = outputCRS.mapUnits();
19051902

19061903
//read layer coordinate transforms from project file (e.g. ct with special datum shift)
19071904
if ( mConfigParser )
@@ -1914,6 +1911,11 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const
19141911
mMapRenderer->addLayerCoordinateTransform( ltIt->first, t.srcAuthId, t.destAuthId, t.srcDatumTransform, t.destDatumTransform );
19151912
}
19161913
}
1914+
1915+
//then set destinationCrs
1916+
mMapRenderer->setDestinationCrs( outputCRS );
1917+
mMapRenderer->setProjectionsEnabled( true );
1918+
mapUnits = outputCRS.mapUnits();
19171919
}
19181920
mMapRenderer->setMapUnits( mapUnits );
19191921

0 commit comments

Comments
 (0)