Skip to content

Commit

Permalink
split proj4string on spaces followed by '+' (instead of spaces only).
Browse files Browse the repository at this point in the history
  • Loading branch information
brushtyler committed Dec 28, 2011
1 parent 4629900 commit 2a83033
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,18 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String

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

QString sql = "SELECT * FROM tbl_srs WHERE ";
QString delim = "";
QString datum;
foreach( QString param, theProj4String.split( " ", QString::SkipEmptyParts ) )

// split on spaces followed by a plus sign (+) to deal
// also with parameters containing spaces (e.g. +nadgrids)
foreach( QString param, theProj4String.split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
{
QString arg = QString( "' '||parameters||' ' LIKE %1" ).arg( quotedValue( QString( "% %1 %" ).arg( param ) ) );
if ( param.startsWith( "+datum=" ) )
Expand Down

0 comments on commit 2a83033

Please sign in to comment.