Opening WMS changes QGIS Project/Main canvas CRS to EPSG:3857

Issue #656 resolved
Fabian Thiel created an issue

How to reproduce:

  • Go to Tools → Open WMS Layer
  • Select e.g. Google Satellite
  • In Data Sources select this layer and open in new Map View

Comments (6)

  1. Benjamin Jakimow

    Data Source URL:

    type=xyz&url=https://mt1.google.com/vt/lyrs%3Ds%26x%3D{x}%26y%3D{y}%26z%3D{z}&zmax=19&zmin=0
    

  2. Benjamin Jakimow

    This behavior is cause by the QgsLayerTreeMapCanvasBrigde (qgsmaplayertree.cpp line 112 ff):

      if ( mFirstCRS.isValid() && firstLayers )
      {
        const QgsGui::ProjectCrsBehavior projectCrsBehavior = QgsSettings().enumValue( QStringLiteral( "/projections/newProjectCrsBehavior" ),  QgsGui::UseCrsOfFirstLayerAdded, QgsSettings::App );
        switch ( projectCrsBehavior )
        {
          case QgsGui::UseCrsOfFirstLayerAdded:
          {
            const bool planimetric = QgsSettings().value( QStringLiteral( "measure/planimetric" ), true, QgsSettings::Core ).toBool();
            // Only adjust ellipsoid to CRS if it's not set to planimetric
            QgsProject::instance()->setCrs( mFirstCRS, !planimetric );
            break;
          }
    
          case QgsGui::UsePresetCrs:
            break;
        }
      }
    

    In a new EnMAP-Box MapView, the QgsLayerTreeMapCanvasBrigde connected the QgsMapCanvas with its LayerTree. Added a new layer to the QgsMapCanvas will set mFirstCRS to the new layers’s CRS and trigger:

    QgsProject::instance()->setCrs( mFirstCRS, !planimetric )

    which changes the QGIS MapCanvas CRS. By commit history, this has been added to

  3. Benjamin Jakimow

    @Fabian Thiel the problem should not exist anymore if there is at least one layers visible in the main QGIS layer tree. Please check and close this issue if appropriate.

  4. Log in to comment