Skip to content

Commit b247c7c

Browse files
committedOct 7, 2018
More hacking around crs db
1 parent 086b6a8 commit b247c7c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎src/core/qgscoordinatereferencesystem.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,10 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
16121612
proj4String = toProj4();
16131613
}
16141614

1615+
// ellipsoid acroynym column is incorrect marked as not null in many crs database instances,
1616+
// hack around this by using an empty string instead
1617+
const QString quotedEllipsoidString = ellipsoidAcronym().isNull() ? "''" : QgsSqliteUtils::quotedString( ellipsoidAcronym() );
1618+
16151619
//if this is the first record we need to ensure that its srs_id is 10000. For
16161620
//any rec after that sqlite3 will take care of the autonumbering
16171621
//this was done to support sqlite 3.0 as it does not yet support
@@ -1622,7 +1626,7 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
16221626
+ QString::number( USER_CRS_START_ID )
16231627
+ ',' + QgsSqliteUtils::quotedString( name )
16241628
+ ',' + QgsSqliteUtils::quotedString( projectionAcronym() )
1625-
+ ',' + QgsSqliteUtils::quotedString( ellipsoidAcronym() )
1629+
+ ',' + quotedEllipsoidString
16261630
+ ',' + QgsSqliteUtils::quotedString( toProj4() )
16271631
+ ",0)"; // <-- is_geo shamelessly hard coded for now
16281632
}
@@ -1631,7 +1635,7 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
16311635
mySql = "insert into tbl_srs (description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
16321636
+ QgsSqliteUtils::quotedString( name )
16331637
+ ',' + QgsSqliteUtils::quotedString( projectionAcronym() )
1634-
+ ',' + QgsSqliteUtils::quotedString( ellipsoidAcronym() )
1638+
+ ',' + quotedEllipsoidString
16351639
+ ',' + QgsSqliteUtils::quotedString( toProj4() )
16361640
+ ",0)"; // <-- is_geo shamelessly hard coded for now
16371641
}

0 commit comments

Comments
 (0)
Please sign in to comment.