Forum

Author Topic: Different WKT content between CRS definition and output files  (Read 2220 times)

DLR-DEV

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hello,

I runned a process with this CRS: EPSG:27562.
The WKT of this CRS is that:
Code: [Select]
PROJCS["NTF (Paris) / Lambert Centre France",
    GEOGCS["NTF (Paris)",
        DATUM["Nouvelle_Triangulation_Francaise_Paris",
            SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936265,
                AUTHORITY["EPSG","7011"]],
            TOWGS84[-168,-60,320,0,0,0,0],
            AUTHORITY["EPSG","6807"]],
        PRIMEM["Paris",2.33722917,
            AUTHORITY["EPSG","8903"]],
        UNIT["grad",0.01570796326794897,
            AUTHORITY["EPSG","9105"]],
        AUTHORITY["EPSG","4807"]],
    PROJECTION["Lambert_Conformal_Conic_1SP"],
    PARAMETER["latitude_of_origin",52],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",0.99987742],
    PARAMETER["false_easting",600000],
    PARAMETER["false_northing",200000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    AUTHORITY["EPSG","27562"]]

When i print the wkt from python console, i got the same content, it's ok:
Code: [Select]
>>> chunk.crs.wkt
'PROJCS["NTF (Paris) / Lambert Centre France",GEOGCS["NTF (Paris)",DATUM["Nouvelle Triangulation Francaise (Paris)",SPHEROID["Clarke 1880 (IGN)",6378249.2,293.466021293627,AUTHORITY["EPSG","7011"]],TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]],UNIT["grad",0.01570796326794895,AUTHORITY["EPSG","9105"]],AUTHORITY["EPSG","4807"]],PROJECTION["Lambert_Conformal_Conic_1SP",AUTHORITY["EPSG","9801"]],PARAMETER["latitude_of_origin",52],PARAMETER["central_meridian",0],PARAMETER["scale_factor",0.99987742],PARAMETER["false_easting",600000],PARAMETER["false_northing",200000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27562"]]'

As you can see, the PRIMEM value of GEOGCS section is:
Code: [Select]
PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]]


But, after doing any export (export DEM, export Ortho) as GeoTiff, the WKT content in the header of the tif file is different :
Code: [Select]
PROJCS["NTF (Paris) / Lambert Centre France",
    GEOGCS["NTF (Paris)",
        DATUM["Nouvelle_Triangulation_Francaise_Paris",
            SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,
                AUTHORITY["EPSG","7011"]],
            TOWGS84[-168,-60,320,0,0,0,0],
            AUTHORITY["EPSG","6807"]],
        PRIMEM["Paris",2.5969213],
        UNIT["grad",0.01570796326794897],
        AUTHORITY["EPSG","4807"]],
    PROJECTION["Lambert_Conformal_Conic_1SP"],
    PARAMETER["latitude_of_origin",52],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",0.99987742],
    PARAMETER["false_easting",600000],
    PARAMETER["false_northing",200000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","27562"]]

As you can see, the PRIMEM value of GEOGCS section is:
Code: [Select]
PRIMEM["Paris",2.5969213]

Because of the difference of this value (2.33722917 VS 2.5969213) i have a shift in longitude in my exports. (note that is the same thing for pointcloud LAS export).

Why Metashape does not write the same WKT content as the used chunk CRS? Is there something to do in Metashape to change that?

Thank you.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13995
    • View Profile
Re: Different WKT content between CRS definition and output files
« Reply #1 on: July 25, 2019, 01:22:40 PM »
Hello DLR-DEV,

Can you please specify, which application or tool you are using to view the information related to the exported TIFF header?
Best regards,
Alexey Pasumansky,
Agisoft LLC

DLR-DEV

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Different WKT content between CRS definition and output files
« Reply #2 on: July 26, 2019, 12:33:42 PM »
I use gdalinfo (version 2.2.3)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13995
    • View Profile
Re: Different WKT content between CRS definition and output files
« Reply #3 on: July 26, 2019, 04:51:47 PM »
Hello DLR-DEV,

Looks like gdal is providing the output for PRIMEM section using gradians as units, whereas in Metashape degrees are used.

2.5969213 (grad) / 400 *360 =  2.33722917 (deg)
Best regards,
Alexey Pasumansky,
Agisoft LLC

DLR-DEV

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Different WKT content between CRS definition and output files
« Reply #4 on: July 29, 2019, 05:35:10 PM »
Hello,

Indeed, one is in gradians, one is in degrees. But it is the AUTHORITY["EPSG","8903"] in the PRIMEM section that handle it, and this authority is missing in the Metashape exported file.

When i try to force the EPSG:27562 with gdal, i got the good wkt content, with the value in degrees with the authority:

Code: [Select]
$ gdal_translate -a_srs EPSG:27562 DSM.tif DSM_out.tif
Input file size is 9245, 9420
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdalinfo DSM_out.tif
Driver: GTiff/GeoTIFF
Files: DSM_out.tif
Size is 9245, 9420
Coordinate System is:
PROJCS["NTF (Paris) / Lambert Centre France",
    GEOGCS["NTF (Paris)",
        DATUM["Nouvelle_Triangulation_Francaise_Paris",
            SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,
                AUTHORITY["EPSG","7011"]],
            TOWGS84[-168,-60,320,0,0,0,0],
            AUTHORITY["EPSG","6807"]],
        PRIMEM["Paris",2.33722917,
            AUTHORITY["EPSG","8903"]],
        UNIT["grad",0.01570796326794897,
            AUTHORITY["EPSG","9105"]],
        AUTHORITY["EPSG","4807"]],
    PROJECTION["Lambert_Conformal_Conic_1SP"],
    PARAMETER["latitude_of_origin",52],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",0.99987742],
    PARAMETER["false_easting",600000],
    PARAMETER["false_northing",200000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    AUTHORITY["EPSG","27562"]]

Here, the PRIMEM used by gdal is good, with the AUTHORITY["EPSG","8903"] inside, i think the main thing is this missing authority in the Metashape exported file.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 13995
    • View Profile
Re: Different WKT content between CRS definition and output files
« Reply #5 on: August 05, 2019, 06:36:13 PM »
Hello DLR-DEV,

I'm attaching the listgeo.exe output related to the GeoTIFF meta data exported from Metashape Pro 1.5.2 and pre-release version of 1.5.4 (build 8733 that I have sent to you). You can see that GeogPrimeMeridianLongGeoKey has proper value (in gradians) from the newer version output.

Can you please confirm, if you are observing the same change compared to the older Metashape version export, if you use the pre-release build?
Best regards,
Alexey Pasumansky,
Agisoft LLC

DLR-DEV

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Different WKT content between CRS definition and output files
« Reply #6 on: August 28, 2019, 04:49:37 PM »
Hello,

I see the difference with listgeo.exe between 1.5.2 and 1.5.4 pre-release. But there is no difference in the WKT and files still remain bad-positionned. :-\

The only way for me to use my exported file is to fix it with that kind of command:

Code: [Select]
gdal_translate -a_srs EPSG:27562 input-from-metashape.tif output.tif

And here is the content of the listgeo.exe for the outut file:

Code: [Select]
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      ModelTiepointTag (2,3):
         0                0                0               
         402303.536       212647.196       0               
      ModelPixelScaleTag (1,3):
         0.1              0.1              0               
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,36): "NTF (Paris) / Lambert Centre France"
      GeogCitationGeoKey (Ascii,12): "NTF (Paris)"
      GeogAngularUnitsGeoKey (Short,1): Angular_Grad
      Unknown-2062 (Double,3): -168             -60              320             
      ProjectedCSTypeGeoKey (Short,1): Unknown-27562
      ProjLinearUnitsGeoKey (Short,1): Linear_Meter
      End_Of_Keys.
   End_Of_Geotiff.

PCS = 27562 (name unknown)
Projection Linear Units: 9001/metre (1.000000m)

Corner Coordinates:
Upper Left    (  402303.536,  212647.196)
Lower Left    (  402303.536,  212050.396)
Upper Right   (  402889.236,  212647.196)
Lower Right   (  402889.236,  212050.396)
Center        (  402596.386,  212348.796)

As you can see, there is less information comparing to your files, but it works fine for me.