<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Unless you are interested in sub-millimetric precision, you
      shouldn't care about the difference between GRS80 and WGS84:<br>
    </p>
    <p><br>
    </p>
    <p>$ echo 4189881.02 146313.87 4790558.75 | bin/cct -d 4
      +proj=pipeline  +step +inv +proj=cart +ellps=WGS84  +step
      +proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000
      +y_0=6600000 +ellps=GRS80<br>
        626830.1633   6878250.0291        0.0017           inf<br>
    </p>
    <p><br>
    </p>
    <p>$ echo 4189881.02 146313.87 4790558.75 | bin/cct -d 4
      +proj=pipeline  +step +inv +proj=cart +ellps=GRS80  +step
      +proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44 +x_0=700000
      +y_0=6600000 +ellps=GRS80<br>
        626830.1633   6878250.0292        0.0017           inf<br>
    </p>
    <p><br>
    </p>
    <p>And if you care about sub-millimetric precision you shouldn't
      attempt at doing that transformation at all, since the "RGF93 v1
      to WGS 84 (1)" null-transformation has an advertized accuracy of 1
      metre.</p>
    <p><br>
    </p>
    <p>Instead of using EPSG:4978, you'd probably want to use EPSG:4937
      (ETRS89 geocentric) to avoid entirely the issues with WGS 84.<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 16/10/2024 à 09:26, Christian
      DOULIAC a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:0674f806e38e4f88bc261e06bab6fd51@magellium.fr">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
        dir="ltr">
        <p>Hello and sorry to spam this subject a bit.<br>
        </p>
        <p><br>
        </p>
        <p>I have created a workaround in my code by checking the
          "PJ_TYPE" and "<span>proj_crs_promote_to_3D</span>" the CRS if
          it is a "<span>PJ_TYPE_GEOGRAPHIC_2D_CRS</span>" or a "<span>PJ_TYPE_PROJECTED_CRS</span>".<br>
        </p>
        <p><br>
        </p>
        <p>It works pretty well except for one case : <br>
        </p>
        <div>Conversion from "EPSG:4978" to "EPSG:2154" <br>
        </div>
        <div>-In proj 9.2 without promotion the "<span>proj_create_crs_to_crs_from_pj</span>"
          function return me a transformation like this :
          <br>
          <span>+proj=pipeline <br>
            +step +inv +proj=cart +ellps=WGS84 <br>
            +step +proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49 +lat_2=44
            +x_0=700000 +y_0=6600000 +ellps=GRS80</span><br>
        </div>
        -In proj 9.2 with promotion it gave me this : <br>
        <span>+proj=pipeline <br>
        </span>
        <p><span>+step +inv +proj=cart +ellps=GRS80 <br>
          </span></p>
        <p><span>+step +proj=lcc +lat_0=46.5 +lon_0=3 +lat_1=49
            +lat_2=44 +x_0=700000 +y_0=6600000 +ellps=GRS80</span></p>
        <p><br>
        </p>
        <p>The only difference <span>is the change from "+ellps=WGS84"
            to "+ellps=GRS80".</span></p>
        <div>The 2nd transformation seems to be more accurate because
          "EPSG:2154" is based on the GRS80, is it true?
          <br>
          How can I recreate the past behavior with the C API? (Having <span>"+ellps=WGS84"</span>).
          Ideally I would like a code that is not specific for this
          case.<br>
          <br>
          Thank <span>you for taking the time to read</span> me.<br>
        </div>
        <br>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>De :</b> PROJ
          <a class="moz-txt-link-rfc2396E" href="mailto:proj-bounces@lists.osgeo.org"><proj-bounces@lists.osgeo.org></a> de la part de Christian
          DOULIAC via PROJ <a class="moz-txt-link-rfc2396E" href="mailto:proj@lists.osgeo.org"><proj@lists.osgeo.org></a><br>
          <b>Envoyé :</b> mercredi 2 octobre 2024 14:55:02<br>
          <b>À :</b> Even Rouault; <a class="moz-txt-link-abbreviated" href="mailto:proj@lists.osgeo.org">proj@lists.osgeo.org</a><br>
          <b>Objet :</b> Re: [PROJ] [Questions] Vertical transformations
          advices for PROJ >= 9.1 version</font>
        <div> </div>
      </div>
      <div>
        <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
        <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
          dir="ltr">
          <div>Hello thanks for your quick answer, <br>
            <br>
            Indeed adding --3d to cs2cs command give me the past
            behavior. <br>
            The commands that I wrote were only here for the example, to
            illustrate that I can recreate the behaviors.<br>
            My goal is to be more generic, I would like to be able to do
            CRS conversions without knownledges of them at first, using
            the PROJ C API.  <br>
            <br>
            I found some advices here
            <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/PROJ/pull/3119#issuecomment-1069272183">https://github.com/OSGeo/PROJ/pull/3119#issuecomment-1069272183</a>
            <br>
            and here
            <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/PROJ/pull/3119#issuecomment-1069272183">https://github.com/OSGeo/PROJ/pull/3119#issuecomment-1069272183</a>
            .<br>
            What I understood from theses comments is that promoting CRS
            to 3D only make sense for PJ_TYPE_GEOGRAPHIC_2D_CRS and
            PJ_TYPE_PROJECTED_CRS types.<br>
            I would like to detect theses cases and promoting the CRS
            accordingly with the API.<br>
            <br>
            My questions are multiple : <br>
            -first did I understood right? <br>
            -Are there others cases (or types) that I should think
            about? <br>
            -Is looking for the CRS type is enough or should I look for
            other information?</div>
        </div>
        <hr style="display:inline-block;width:98%" tabindex="-1">
        <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
            face="Calibri, sans-serif" color="#000000"><b>De :</b> Even
            Rouault <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a><br>
            <b>Envoyé :</b> mardi 1 octobre 2024 15:13:11<br>
            <b>À :</b> Christian DOULIAC; <a class="moz-txt-link-abbreviated" href="mailto:proj@lists.osgeo.org">proj@lists.osgeo.org</a><br>
            <b>Objet :</b> Re: [PROJ] [Questions] Vertical
            transformations advices for PROJ >= 9.1 version</font>
          <div> </div>
        </div>
        <div>
          <p><br>
          </p>
          <div class="moz-cite-prefix">Le 01/10/2024 à 11:04, Christian
            DOULIAC via PROJ a écrit :<br>
          </div>
          <blockquote type="cite"
            cite="mid:89c8212f2f044a45a02dae850bcf9b32@magellium.fr">
            <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
            <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
              dir="ltr">
              <p dir="auto">Hello, I would like some precision about CRS
                conversions.</p>
              <p dir="auto">I'm aware that there are some changes about
                vertical transformations with PROJ >= 9.1 as stated
                here :
                <a class="issue-link js-issue-link"
                  data-error-text="Failed to load title"
                  data-id="1170903012"
                  data-permission-text="Title is private"
                  data-url="https://github.com/OSGeo/PROJ/issues/3119"
                  data-hovercard-type="pull_request"
                  data-hovercard-url="/OSGeo/PROJ/pull/3119/hovercard"
                  href="https://github.com/OSGeo/PROJ/pull/3119"
                  moz-do-not-send="true">
                </a><a href="https://github.com/OSGeo/PROJ/pull/3119"
                  class="OWAAutoLink moz-txt-link-freetext"
                  id="LPlnk868644" moz-do-not-send="true">https://github.com/OSGeo/PROJ/pull/3119</a>
                <br>
                Or here : <a
href="https://proj.org/en/9.4/apps/cs2cs.html#cmdoption-cs2cs-3d"
                  rel="nofollow" moz-do-not-send="true"
                  class="moz-txt-link-freetext">
https://proj.org/en/9.4/apps/cs2cs.html#cmdoption-cs2cs-3d</a> "Starting
                with PROJ 9.1, both CRS need to be 3D for vertical
                transformation to possibly happen."</p>
              <p dir="auto"><br>
                I tested it and I recreated the behavior of pre 9.1 and
                post 9.1 versions :</p>
              <p dir="auto">-PROJ 8.2.0 :<br>
                echo 0 0 1000 | cs2cs +proj=longlat +datum=WGS84
                +geoidgrids=/proj-build/data/for_tests/egm96_15.tif
                +vunits=m +no_defs +type=crs +to +proj=longlat
                +datum=WGS84 +no_defs +type=crs -f "%.14f"<br>
                0.00000000000000 0.00000000000000 1017.16157913208008</p>
              <p dir="auto">-PROJ 9.2.0<br>
                echo 0 0 1000 | cs2cs +proj=longlat +datum=WGS84
                +geoidgrids=/proj-build/data/for_tests/egm96_15.tif
                +vunits=m +no_defs +type=crs +to +proj=longlat
                +datum=WGS84 +no_defs +type=crs -f "%.14f"<br>
                0.00000000000000 0.00000000000000 1000.00000000000000</p>
            </div>
          </blockquote>
          <p>Add --3d to promote the target CRS to 3D.</p>
          <p><br>
          </p>
          <p>Or use: cs2cs -f "%.14f" EPSG:4326+5773 EPSG:4979  (with
            lat, long order)<br>
          </p>
          <span style="white-space: pre-wrap"></span>
          <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com"
          moz-do-not-send="true">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
        </div>
      </div>
    </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.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.</pre>
  </body>
</html>