<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>André,</p>
    <p>I don't confirm this trying:<br>
    </p>
    <p>$ gdal_translate autotest/gcore/data/byte.tif byte.bag</p>
    <p>$ gdalinfo byte.bag -mdd xml:BAG | grep PROJCS<br>
                  <gco:CharacterString>PROJCS["NAD27 / UTM zone
      11N",GEOGCS["NAD27",DATUM["North_American_Datum_1927",SPHEROID["Clarke
1866",6378206.4,294.978698213898,AUTHORITY["EPSG","7008"]],AUTHORITY["EPSG","6267"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4267"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","26711"]]</gco:CharacterString></p>
    <p>This is WKT1</p>
    <p>I'm wondering if the confusion might come from looking at the CRS
      reported by gdalinfo, which will always be WKT2 in recent GDAL
      versions whatever the encoding in the source dataset itself ?</p>
    <p>Or perhaps you try to write a Geographic 3D CRS ? in which case
      WKT2 will be used since there's no WKT1 representation for this<br>
    </p>
    <p>$ gdalwarp -overwrite autotest/gcore/data/byte.tif byte.bag
      -t_srs EPSG:4979 -ot float32<br>
    </p>
    <p>$ gdalinfo byte.bag -mdd xml:BAG | grep GEOGCRS<br>
                  <gco:CharacterString>GEOGCRS["WGS
      84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World
      Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System
      1984 (G730)"],MEMBER["World Geodetic System 1984
      (G873)"],MEMBER["World Geodetic System 1984
      (G1150)"],MEMBER["World Geodetic System 1984
      (G1674)"],MEMBER["World Geodetic System 1984
      (G1762)"],MEMBER["World Geodetic System 1984
      (G2139)"],ELLIPSOID["WGS
84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,3],AXIS["geodetic
      latitude
(Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic
      longitude
(Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],AXIS["ellipsoidal
      height (h)",up,ORDER[3],LENGTHUNIT["metre",1]], [... snip ....]
      ,ID["EPSG",4979]]</gco:CharacterString></p>
    <p>(I see that gdalinfo also issues a "ERROR 1: PROJ:
      proj_create_compound_crs: components of the compound CRS do not
      belong to one of the allowed combinations of
      <a class="moz-txt-link-freetext" href="http://docs.opengeospatial.org/as/18-005r4/18-005r4.html#34">http://docs.opengeospatial.org/as/18-005r4/18-005r4.html#34</a>" when
      reading this, which I suspect comes from the fact that it tries to
      create a CompoundCRS from this 3D GeogCRS and the
      "VERT_CS["unknown", VERT_DATUM["unknown", 2000]]", so writing 3D
      GeogCRS isn't really appropriate for BAG)<br>
    </p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 22/04/2022 à 18:01, Vautour, André
      (INT) a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:YT3PR01MB493035E1067A542F6673B34E97F79@YT3PR01MB4930.CANPRD01.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span lang="EN-CA">Hi all,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA">It has just come to my
            attention that the BAG driver in GDAL is writing the CRS
            with a WKT codeSpace and a WKT 2.0 string as the code. While
            I am fairly sure we started that incorrect practice here at
            CARIS with a WKT 1.0 string, this is the first time I’ve
            seen a WKT 2.0 string written in there, and I am therefore
            concerned about interoperability.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA">I think we can all agree
            that what makes the most sense is to write an EPSG codebase
            with the EPSG code if we have it, and I think falling back
            to a WKT 1.0 string if it is not EPSG is a reasonable
            fallback if it is not EPSG, given how it has been used in
            the past, but I am worried that older software won’t
            recognize the WKT 2.0 string.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA">Would you be willing to
            take a pull request that does that? Worst-case, would you be
            fine with changing that WKT 2.0 string to a WKT 1.0 string?<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA">Regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-CA">Andr</span><span
            lang="FR-CA">é<o:p></o:p></span></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>