Skip to content

Commit 5635391

Browse files
committed
fix #5176
1 parent d651892 commit 5635391

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

src/core/qgscoordinatereferencesystem.cpp

+23-12
Original file line numberDiff line numberDiff line change
@@ -1078,27 +1078,38 @@ bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode )
10781078
{
10791079
bool initialized = false;
10801080

1081-
QDomNode myNode = srsNode.namedItem( "authid" );
1082-
if ( !myNode.isNull() )
1083-
{
1084-
operator=( QgsCRSCache::instance()->crsByAuthId( myNode.toElement().text() ) );
1085-
if ( isValid() )
1086-
{
1087-
initialized = true;
1088-
}
1089-
}
1081+
long srsid = srsNode.namedItem( "srsid" ).toElement().text().toLong();
10901082

1091-
if ( !initialized )
1083+
QDomNode myNode;
1084+
1085+
if ( srsid < USER_CRS_START_ID )
10921086
{
1093-
myNode = srsNode.namedItem( "epsg" );
1087+
myNode = srsNode.namedItem( "authid" );
10941088
if ( !myNode.isNull() )
10951089
{
1096-
operator=( QgsCRSCache::instance()->crsByEpsgId( myNode.toElement().text().toLong() ) );
1090+
operator=( QgsCRSCache::instance()->crsByAuthId( myNode.toElement().text() ) );
10971091
if ( isValid() )
10981092
{
10991093
initialized = true;
11001094
}
11011095
}
1096+
1097+
if ( !initialized )
1098+
{
1099+
myNode = srsNode.namedItem( "epsg" );
1100+
if ( !myNode.isNull() )
1101+
{
1102+
operator=( QgsCRSCache::instance()->crsByEpsgId( myNode.toElement().text().toLong() ) );
1103+
if ( isValid() )
1104+
{
1105+
initialized = true;
1106+
}
1107+
}
1108+
}
1109+
}
1110+
else
1111+
{
1112+
QgsDebugMsg( "Ignoring authid/epsg for user crs." );
11021113
}
11031114

11041115
if ( initialized )

0 commit comments

Comments
 (0)