store original proj4 representation of a CRS in the QgsCoordinateReferenceSystem class #1130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when creating a custom CRS, the string entered by the user is not saved but only used to create a CRS by calling the function OSRImportFromProj4 from OGR. The proj4 shown when listing the custom CRS is the proj4 generated by a call to OSRExportToProj4.
This behavior means the string is modified without informing the user, changing the order of the arguments, adding or removing defaut values, etc. This is confusing and IMHO a behavior that should be avoided. Additionally, the two strings (input and OGR export) are supposed to be equivalent, but this is not always the case. The CRS replacement can be involved in issues such as http://hub.qgis.org/issues/9414.
This pull request adds a field mProj4 to the QgsCoordinateReferenceSystem, in order to be able to save the preferred proj4 representation and use it if possible. If no field has been defined, the OSRExportToProj4 is used. I have more ambitious changes I would like to make later, but this seems to solve bug #9414, so I would like to include this small modification for 2.2.