Skip to content

Commit 56808d9

Browse files
committed
fix #5176
1 parent 85cf8c3 commit 56808d9

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,27 +1051,38 @@ bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode )
10511051
{
10521052
bool initialized = false;
10531053

1054-
QDomNode myNode = srsNode.namedItem( "authid" );
1055-
if ( !myNode.isNull() )
1056-
{
1057-
operator=( QgsCRSCache::instance()->crsByAuthId( myNode.toElement().text() ) );
1058-
if ( isValid() )
1059-
{
1060-
initialized = true;
1061-
}
1062-
}
1054+
long srsid = srsNode.namedItem( "srsid" ).toElement().text().toLong();
10631055

1064-
if ( !initialized )
1056+
QDomNode myNode;
1057+
1058+
if ( srsid < USER_CRS_START_ID )
10651059
{
1066-
myNode = srsNode.namedItem( "epsg" );
1060+
myNode = srsNode.namedItem( "authid" );
10671061
if ( !myNode.isNull() )
10681062
{
1069-
operator=( QgsCRSCache::instance()->crsByEpsgId( myNode.toElement().text().toLong() ) );
1063+
operator=( QgsCRSCache::instance()->crsByAuthId( myNode.toElement().text() ) );
10701064
if ( isValid() )
10711065
{
10721066
initialized = true;
10731067
}
10741068
}
1069+
1070+
if ( !initialized )
1071+
{
1072+
myNode = srsNode.namedItem( "epsg" );
1073+
if ( !myNode.isNull() )
1074+
{
1075+
operator=( QgsCRSCache::instance()->crsByEpsgId( myNode.toElement().text().toLong() ) );
1076+
if ( isValid() )
1077+
{
1078+
initialized = true;
1079+
}
1080+
}
1081+
}
1082+
}
1083+
else
1084+
{
1085+
QgsDebugMsg( "Ignoring authid/epsg for user crs." );
10751086
}
10761087

10771088
if ( initialized )

0 commit comments

Comments
 (0)