@@ -134,6 +134,17 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString theDefinition
134134 if ( reCrsStr.cap ( 1 ).toLower () == " proj4" )
135135 {
136136 result = createFromProj4 ( reCrsStr.cap ( 2 ) );
137+ // TODO: createFromProj4 used to save to the user database any new CRS
138+ // this behavior was changed in order to separate creation and saving.
139+ // Not sure if it necessary to save it here, should be checked by someone
140+ // familiar with the code (should also give a more descriptive name to the generated CRS)
141+ if ( srsid () == 0 )
142+ {
143+ QString myName = QString ( " * %1 (%2)" )
144+ .arg ( QObject::tr ( " Generated CRS" , " A CRS automatically generated from layer info get this prefix for description" ) )
145+ .arg ( toProj4 () );
146+ saveAsUserCRS (myName);
147+ }
137148 }
138149 else
139150 {
@@ -460,6 +471,17 @@ bool QgsCoordinateReferenceSystem::createFromWkt( QString theWkt )
460471
461472 createFromProj4 ( proj4src );
462473 }
474+ // TODO: createFromProj4 used to save to the user database any new CRS
475+ // this behavior was changed in order to separate creation and saving.
476+ // Not sure if it necessary to save it here, should be checked by someone
477+ // familiar with the code (should also give a more descriptive name to the generated CRS)
478+ if ( mSrsId == 0 )
479+ {
480+ QString myName = QString ( " * %1 (%2)" )
481+ .arg ( QObject::tr ( " Generated CRS" , " A CRS automatically generated from layer info get this prefix for description" ) )
482+ .arg ( toProj4 () );
483+ saveAsUserCRS (myName);
484+ }
463485
464486 CPLFree ( proj4src );
465487
@@ -1190,6 +1212,18 @@ bool QgsCoordinateReferenceSystem::readXML( QDomNode & theNode )
11901212 // @TODO this srs needs to be validated!!!
11911213 mIsValidFlag = true ; // shamelessly hard coded for now
11921214 }
1215+ // TODO: createFromProj4 used to save to the user database any new CRS
1216+ // this behavior was changed in order to separate creation and saving.
1217+ // Not sure if it necessary to save it here, should be checked by someone
1218+ // familiar with the code (should also give a more descriptive name to the generated CRS)
1219+ if ( mSrsId == 0 )
1220+ {
1221+ QString myName = QString ( " * %1 (%2)" )
1222+ .arg ( QObject::tr ( " Generated CRS" , " A CRS automatically generated from layer info get this prefix for description" ) )
1223+ .arg ( toProj4 () );
1224+ saveAsUserCRS (myName);
1225+ }
1226+
11931227 }
11941228 }
11951229 else
0 commit comments