Skip to content

Commit 49ebe67

Browse files
jef-nmach0
authored andcommitted
For EPSG initialize GDAL CRS from authid instead of proj.4 string
1 parent b79c4d3 commit 49ebe67

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/core/qgscoordinatereferencesystem.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,18 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString expression, Q
263263
{
264264
mAuthId = QString( "USER:%1" ).arg( mSrsId );
265265
}
266+
else if ( mAuthId.startsWith( "EPSG:", Qt::CaseInsensitive ) )
267+
{
268+
OSRDestroySpatialReference( mCRS );
269+
mCRS = OSRNewSpatialReference( NULL );
270+
mIsValidFlag = OSRSetFromUserInput( mCRS, mAuthId.toLower().toAscii() ) == OGRERR_NONE;
271+
setMapUnits();
272+
}
266273

267-
setProj4String( toProj4 );
268-
setMapUnits();
274+
if ( !mIsValidFlag )
275+
{
276+
setProj4String( toProj4 );
277+
}
269278
}
270279
else
271280
{

0 commit comments

Comments
 (0)