Skip to content

Commit 2a83033

Browse files
committedDec 28, 2011
split proj4string on spaces followed by '+' (instead of spaces only).
see http://trac.osgeo.org/proj/ticket/132
1 parent 4629900 commit 2a83033

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,18 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String
455455

456456
if ( myRecord.empty() )
457457
{
458-
// match all arameters individually:
458+
// match all parameters individually:
459459
// - order of parameters doesn't matter
460460
// - found definition may have more parameters (like +towgs84 in GDAL)
461461
// - retry without datum, if no match is found (looks like +datum<>WGS84 was dropped in GDAL)
462462

463463
QString sql = "SELECT * FROM tbl_srs WHERE ";
464464
QString delim = "";
465465
QString datum;
466-
foreach( QString param, theProj4String.split( " ", QString::SkipEmptyParts ) )
466+
467+
// split on spaces followed by a plus sign (+) to deal
468+
// also with parameters containing spaces (e.g. +nadgrids)
469+
foreach( QString param, theProj4String.split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
467470
{
468471
QString arg = QString( "' '||parameters||' ' LIKE %1" ).arg( quotedValue( QString( "% %1 %" ).arg( param ) ) );
469472
if ( param.startsWith( "+datum=" ) )

0 commit comments

Comments
 (0)
Please sign in to comment.