[QGIS-trac] Re: [Quantum GIS] #1875: A few problems with crs definitions with TOWGS parameters

Quantum GIS qgis at qgis.org
Wed Aug 19 10:05:56 EDT 2009


#1875: A few problems with crs definitions with TOWGS parameters
--------------------------------------------------------------+-------------
        Reporter:  lutra                                      |         Owner:  homann       
            Type:  bug                                        |        Status:  closed       
        Priority:  critical: causes crash or data corruption  |     Milestone:  Version 1.2.0
       Component:  Projection Support                         |       Version:  HEAD         
      Resolution:  fixed                                      |      Keywords:               
Platform_version:                                             |      Platform:  All          
        Must_fix:  No                                         |   Status_info:  0            
--------------------------------------------------------------+-------------
Comment (by hamish):

 Replying to [comment:38 homann]:
 > It appears to be something strange about the supplied WKT? If
 > you add a +datum in the Custom CRS and export the file by "Save
 > as shapefile" and supply your changed Custom CRS, a new WKT
 > gets written in the .prj file.

 ok, trying that... I notice a message when I do `Save as shapefile`:
  ''Select the coordinate reference system for the saved shapefile. The
 data points will be transformed from the layer coordinate reference
 system.''

 the output .shp file is binary equal, so I expect that that message might
 be improved to mention that is the set CRS matches the output CRS no
 reprojection will happen. Or is that dialog just for creating the .prj WKT
 and no reprojection of the coordinates will happen if you select wgs84/LL
 and the wording misleading?

 > The conversion from WKT to +proj is done by OGR(?)
 > OSRImportFromWkt(). Also the conversion the other way is done
 > with that library.
 >
 > And the new .prj file is picked up with +datum, and matched
 > against EPSG 27200. Is that correct?

 {{{
 before (GRASS v.out.ogr export):
  PROJCS["New Zealand Map Grid",
    GEOGCS["international",
      DATUM["New_Zealand_Geodetic_Datum_1949",
        SPHEROID["international",6378388,297]],
      PRIMEM["Greenwich",0],
      UNIT["degree",0.0174532925199433]],
    PROJECTION["New_Zealand_Map_Grid"],
    PARAMETER["latitude_of_origin",-41],
    PARAMETER["central_meridian",173],
    PARAMETER["false_easting",2510000],
    PARAMETER["false_northing",6023150],
    UNIT["meter",1]]
 }}}
 {{{
 new .prj after Save as shapefile in QGIS:
  PROJCS["unnamed",
    GEOGCS["NZGD49",
      DATUM["New_Zealand_Geodetic_Datum_1949",
        SPHEROID["International 1924",6378388,297,
          AUTHORITY["EPSG","7022"]],
        TOWGS84[59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993],
        AUTHORITY["EPSG","6272"]],
      PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
      UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],
      AUTHORITY["EPSG","4272"]],
    PROJECTION["New_Zealand_Map_Grid"],
    PARAMETER["latitude_of_origin",-41],
    PARAMETER["central_meridian",173],
    PARAMETER["false_easting",2510000],
    PARAMETER["false_northing",6023150],
    UNIT["Meter",1]]
 }}}


 if I reload the new shapefile into QGIS it automatically selects the
 Projected Cood systems -> NZ Map Grid -> NZGD49/NZMG from the CRS list
 with 27200 in the EPSG column and 2269 in the ID column, and of course
 +datum=nzgd49.

 So the problem is that QGIS's WKT importer is lossy when given WKT created
 by GRASS's v.out.ogr module. That's kind of weird when both use OGR for
 the task. (actually I'm not sure if grass's v.out.ogr uses OGR fns() for
 the WKT creation or if it uses something from elsewhere in the GIS)


 As "DATUM["New_Zealand_Geodetic_Datum_1949"," etc makes it into the GRASS-
 created WKT, I'd consider that sufficient and the info loss happening
 during the import to QGIS. Nothing of interest is printed to the terminal
 (how to switch on debug messages?).



 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1875#comment:40>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list