Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 19, 2019
1 parent 5dd15ed commit cb9f6ab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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() )
Expand Down

0 comments on commit cb9f6ab

Please sign in to comment.