<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>just a few complements to Javier's analysis:</p>
    <p>- what you observe and what Javier mentioned applies if you
      import directly the .prj WKT content, but the GDAL shapefile
      driver actually replaces this not pretty WKT with a cleaned
      version of EPSG:4326 (at least with GDAL+PROJ master), so if you
      use the high level GDAL API, things should work smoothly</p>
    <p>- the 9001 ID you observe when looking at the WKT2 output of the
      result of the ingestion of the .prj  is *not* a CRS ID. It is the
      ID of the ellipsoid's lengthunit=metre. You can have several IDs
      in a WKT definition: for the CRS, datum, ellipsoid, projection
      method, projection parameter, units, etc. They only apply to the
      node to which they are applied to. In some contexts, they are
      advised to be omitted. The general rule is "if you know the id of
      a top-level object, you can omit the IDs of its child elements,
      except in several cases". All gory details at
      <a class="moz-txt-link-freetext" href="https://www.ogc.org/standard/wkt-crs/">https://www.ogc.org/standard/wkt-crs/</a><br>
    </p>
    <p>So all in all, to me things are working as expected. It is mostly
      you deal with a a slightly non-compliant .prj file</p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 28/03/2024 à 03:06, Simon Eves via
      PROJ a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJf0KTRMn_LrVKq78CPQjWU4cKDByuhbnpJESe2N+XdxT+e6XA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">When trying to import this Shapefile bundle into
        our system with GDAL...
        <div><br clear="all">
          <div><a
href="https://drive.google.com/file/d/13Mwhnugcy8HrnGlc81gyroxnp9s15Skt/view?usp=sharing"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://drive.google.com/file/d/13Mwhnugcy8HrnGlc81gyroxnp9s15Skt/view?usp=sharing</a><br>
          </div>
          <div><br>
          </div>
          <div>...we get an <b>OGRERR_CORRUPT_DATA</b> from <b>OGRSpatialReference::Validate()</b>
            on the SR obtained from the first feature.</div>
          <div><br>
          </div>
          <div>Tracing through the GDAL and PROJ code, this appears to
            be because the PROJ import of that CRS results in the
            following WKT Import Error from PROJ...</div>
          <div><br>
          </div>
          <div><i>Coordinate system of GeographicCRS in the WKT
              definition is different from the one of the authority.
              Unsetting the identifier to avoid confusion<br>
            </i></div>
          <div><br>
          </div>
          <div>...and any WKT Import Error makes GDAL report that error
            code.</div>
          <div><br>
          </div>
          The PROJ code throws this in <b>WKTParser::Private::buildGeodeticCRS</b>
          (io.cpp:3229 in 9.3.0) which is old code (although the second
          branch which can throw the same error was seemingly added
          between 8.2 and 9.3 in <a
            href="https://github.com/OSGeo/PROJ/pull/3274"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/OSGeo/PROJ/pull/3274</a>
          ...but it's the first branch that's triggering in this case).</div>
        <div><br>
        </div>
        <div><b>ogrinfo</b> on the Shapefile reports no errors or
          warnings, although it does report a CRS ID of 9001 even though
          it reports WGS84 elsewhere in the CRS block.</div>
        <div><br>
        </div>
        <div>I was able to trivially <b>ogr2ogr</b> it to GeoJSON, also
          with no errors or warnings, and that imports with no issue.</div>
        <div><br>
        </div>
        <div><span class="gmail_signature_prefix">Is there an actual
            problem (a bad file) here, or are we doing something wrong?</span></div>
        <div><span class="gmail_signature_prefix"><br>
          </span></div>
        <div><span class="gmail_signature_prefix">Thanks, as ever, in
            advance.</span></div>
        <div><span class="gmail_signature_prefix"><br>
          </span></div>
        <div><span class="gmail_signature_prefix">-- </span><br>
          <div dir="ltr" class="gmail_signature"
            data-smartmail="gmail_signature">
            <div dir="ltr">Simon Eves
              <div>Senior Rendering Engineer</div>
              <div>+1 (415) 902-1996<br>
                <a href="mailto:simon.eves@heavy.ai" target="_blank"
                  moz-do-not-send="true" class="moz-txt-link-freetext">simon.eves@heavy.ai</a></div>
              <div><span>
                  <p dir="ltr"
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><a
                      href="http://www.heavy.ai" target="_blank"
                      moz-do-not-send="true"><span
style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span
style="border:none;display:inline-block;overflow:hidden;width:156px;height:29px"><img
src="https://lh4.googleusercontent.com/mzi9GaXA9r6isEqIx5nIYx0oQnpZtzBnF19Pu83MUBPDvp_rpcQXv55z-IZcQrybunkhKf6mXNJjIQinIbkHTigssDxIks_tXAaV1aDQzVT8FpE1wOn3MW0W_iiTnDjVZzMUNgs"
                      style="margin-left:0px;margin-top:0px"
                      moz-do-not-send="true" width="156" height="29"></span></span></a></p>
                </span></div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
PROJ mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PROJ@lists.osgeo.org">PROJ@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/proj">https://lists.osgeo.org/mailman/listinfo/proj</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>