Skip to content

Commit

Permalink
sandbox 3d: use projected CRS if project's CRS is not projected
Browse files Browse the repository at this point in the history
3D map views simply don't work with lat/lon CRS
  • Loading branch information
wonder-sk authored and nyalldawson committed Aug 31, 2023
1 parent 4aec105 commit e2094d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/src/3d/sandbox/qgis_3d_sandbox.cpp
Expand Up @@ -42,6 +42,13 @@ void initCanvas3D( Qgs3DMapCanvas *canvas )
QgsLayerTree *root = QgsProject::instance()->layerTreeRoot();
const QList< QgsMapLayer * > visibleLayers = root->checkedLayers();

QgsCoordinateReferenceSystem crs = QgsProject::instance()->crs();
if ( crs.isGeographic() )
{
// we can't deal with non-projected CRS, so let's just pick something
QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3857" ) ) );
}

QgsMapSettings ms;
ms.setDestinationCrs( QgsProject::instance()->crs() );
ms.setLayers( visibleLayers );
Expand Down

0 comments on commit e2094d8

Please sign in to comment.