Bug report #9397

Project's CRS is not written properly in the project's file

Added by Olivier Dalang over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Project Loading/Saving
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17995

Description

Hi !

The project's CRS seems to be written in two places in a QGIS file : in the <properties>/<SpatialRefSys> block and in the <mapcanvas>/<destinationsrs> block.

But those two values are not the same !

Steps to reproduce the bug :
1) Create a new file
2) Save it
3) Change the project's CRS using the project's preferences window
4) Save it again.

While the ID and the proj4 strings seem to be ok, the code is EPSG:2056 in the first block and EPSG:4326 in the second.

That may be the cause of a whole lot of other bugs depending on which of those values is read!

Thanks !

(...)
    <mapcanvas>
(...)
        <projections>1</projections>
        <destinationsrs>
            <spatialrefsys>
                <proj4>+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs</proj4>
                <srsid>47</srsid>
                <srid>2056</srid>
                <authid>EPSG:2056</authid>
                <description>CH1903+ / LV95</description>
                <projectionacronym>somerc</projectionacronym>
                <ellipsoidacronym>bessel</ellipsoidacronym>
                <geographicflag>false</geographicflag>
            </spatialrefsys>
        </destinationsrs>
        <layer_coordinate_transform_info/>
    </mapcanvas>
(...)
    <properties>
(...)
        <SpatialRefSys>
            <ProjectCRSProj4String type="QString">+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs</ProjectCRSProj4String>
            <ProjectCrs type="QString">EPSG:4326</ProjectCrs>
            <ProjectCRSID type="int">47</ProjectCRSID>
        </SpatialRefSys>
(...)

History

#1 Updated by Giovanni Manghi over 10 years ago

  • Target version set to Future Release - High Priority
  • Category set to Project Loading/Saving

#2 Updated by Leyan Ouyang over 10 years ago

I updated the CRS properties management in this pull request, this should solve the issue: https://github.com/qgis/QGIS/pull/1104

#3 Updated by Olivier Dalang over 10 years ago

  • % Done changed from 0 to 100

Great, thanks ! I set done to 100% and hope it will be merged soon !

#4 Updated by Marco Hugentobler over 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF