<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Sorry Even,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I should have done more research on my end up front before sending this. A client told us his WKT 2.0 BAG was created with GDAL. Looking at it some more, it was the vertical CRS that was WKT 2.0.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Their vertical CRS looked as follows:<o:p></o:p></p>
<p class="MsoNormal"><gco:CharacterString>VERTCRS["ellipse",VDATUM["NAD83(2011) / UTM zone 10N + ellipse"],CS[vertical,1],AXIS["ellipsoid height (h)",up,LENGTHUNIT["metre",1]]]</gco:CharacterString><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<p class="MsoNormal">André<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Even Rouault <even.rouault@spatialys.com> <br>
<b>Sent:</b> April 22, 2022 13:22<br>
<b>To:</b> Vautour, André (INT) <Andre.Vautour@Teledyne.com>; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] BAG CRS<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div align="center">
<table class="MsoNormalTable" border="1" cellspacing="0" cellpadding="0" width="150" style="width:112.5pt;border:outset #898989 1.0pt">
<tbody>
<tr>
<td style="border:inset #898989 1.0pt;background:#FDFFB2;padding:3.0pt 3.0pt 3.0pt 3.0pt">
<p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:8.0pt">External Email<o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>André,<o:p></o:p></p>
<p>I don't confirm this trying:<o:p></o:p></p>
<p>$ gdal_translate autotest/gcore/data/byte.tif byte.bag<o:p></o:p></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><o:p></o:p></p>
<p>This is WKT1<o:p></o:p></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 ?<o:p></o:p></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<o:p></o:p></p>
<p>$ gdalwarp -overwrite autotest/gcore/data/byte.tif byte.bag -t_srs EPSG:4979 -ot float32<o:p></o:p></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><o:p></o:p></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 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)<o:p></o:p></p>
<p><span lang="FR-CA">Even<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="FR-CA">Le 22/04/2022 à 18:01, Vautour, André (INT) a écrit :<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-CA">Hi all,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><o:p></o:p></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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><o:p></o:p></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?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-CA"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-CA">Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-CA">Andr</span>é<o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>gdal-dev mailing list<o:p></o:p></pre>
<pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</body>
</html>