Skip to content
Permalink
Browse files

Fix raster CRS

Honestly, a failing server test (apparently totally unrelated)
and bisect took me here and I don't really get all the
intricancies of the crs read order in the project XML loading
process, but this commit fixes the test.

This is one of the notable occasions in which a test saved our a**.
  • Loading branch information
elpaso committed Dec 9, 2019
1 parent 5dd15ed commit cb9f6ab28cf78a859080aa37b2a23bbdfa169f8c
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/core/qgsmaplayer.cpp
@@ -267,12 +267,6 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCon

QgsReadWriteContextCategoryPopper p = context.enterCategory( tr( "Layer" ), mne.text() );

// overwrite CRS with what we read from project file before the raster/vector
// file reading functions changed it. They will if projections is specified in the file.
// FIXME: is this necessary?
QgsCoordinateReferenceSystem::setCustomCrsValidation( savedValidation );
mCRS = savedCRS;

// the internal name is just the data source basename
//QFileInfo dataSourceFileInfo( mDataSource );
//internalName = dataSourceFileInfo.baseName();
@@ -303,6 +297,12 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, QgsReadWriteCon
// now let the children grab what they need from the Dom node.
layerError = !readXml( layerElement, context );

// overwrite CRS with what we read from project file before the raster/vector
// file reading functions changed it. They will if projections is specified in the file.
// FIXME: is this necessary? Yes, it is (autumn 2019)
QgsCoordinateReferenceSystem::setCustomCrsValidation( savedValidation );
mCRS = savedCRS;

//short name
QDomElement shortNameElem = layerElement.firstChildElement( QStringLiteral( "shortname" ) );
if ( !shortNameElem.isNull() )

0 comments on commit cb9f6ab

Please sign in to comment.
You can’t perform that action at this time.