Skip to content

Commit 10de06c

Browse files
committed
For EPSG initialize GDAL CRS from authid instead of proj.4 string
1 parent 306efcb commit 10de06c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,18 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString expression, Q
267267
{
268268
mAuthId = QString( "USER:%1" ).arg( mSrsId );
269269
}
270+
else if ( mAuthId.startsWith( "EPSG:", Qt::CaseInsensitive ) )
271+
{
272+
OSRDestroySpatialReference( mCRS );
273+
mCRS = OSRNewSpatialReference( NULL );
274+
mIsValidFlag = OSRSetFromUserInput( mCRS, mAuthId.toLower().toAscii() ) == OGRERR_NONE;
275+
setMapUnits();
276+
}
270277

271-
setProj4String( toProj4 );
272-
setMapUnits();
278+
if ( !mIsValidFlag )
279+
{
280+
setProj4String( toProj4 );
281+
}
273282
}
274283
else
275284
{

0 commit comments

Comments
 (0)