<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>Mathieu,</p>
    <p><br>
    </p>
    <p>It is not quite true that there is no datum shift. If there was
      no datum shift, you would get the following results (using
      EPSG:32612 to remain in WGS84 datum, but with the UTM zone 12N
      similarly as EPSG:2956):</p>
    <p><br>
    </p>
    <p>$ echo 50.937434634728845 -113.63360224940385 1005.9387180001410
      | cs2cs  -d 3 EPSG:4326 EPSG:32612<br>
      314966.127    5646170.391 1005.939<br>
    </p>
    <p><br>
    </p>
    <p>The result you get in your code is the one of the below
      operation:</p>
    <p><br>
    </p>
    <p>$ projinfo -s EPSG:4326 -t EPSG:2956<br>
      Candidate operations found: 2<br>
      -------------------------------------<br>
      Operation No. 1:<br>
      <br>
      unknown id, Inverse of NAD83(CSRS) to WGS 84 (2) + UTM zone 12N, 1
      m, Canada - onshore and offshore - Alberta; British Columbia;
      Manitoba; New Brunswick; Newfoundland and Labrador; Northwest
      Territories; Nova Scotia; Nunavut; Ontario; Prince Edward Island;
      Quebec; Saskatchewan; Yukon.<br>
      <br>
      PROJ string:<br>
      +proj=pipeline<br>
        +step +proj=axisswap +order=2,1<br>
        +step +proj=unitconvert +xy_in=deg +xy_out=rad<br>
        +step +proj=push +v_3<br>
        +step +proj=cart +ellps=WGS84<br>
        +step +inv +proj=helmert +x=-0.991 +y=1.9072 +z=0.5129
      +rx=-0.0257899075194932<br>
              +ry=-0.0096500989602704 +rz=-0.0116599432323421 +s=0<br>
              +convention=coordinate_frame<br>
        +step +inv +proj=cart +ellps=GRS80<br>
        +step +proj=pop +v_3<br>
        +step +proj=utm +zone=12 +ellps=GRS80<br>
      <br>
    </p>
    <p>As the 2 CRS you use are 2D ones, the Z coordinate is left
      untouched with the push/pop +v_3 steps.</p>
    <p><br>
    </p>
    <p>If you promote the 2 CRS as 3D, you'll get</p>
    <p><br>
    </p>
    <p>$ echo 50.937434634728845 -113.63360224940385 1005.9387180001410
      | cs2cs  -d 3 EPSG:4979 "$(src/projinfo --3d EPSG:2956 -o
      WKT2_2019 --single-line -q)"<br>
      314967.085    5646169.595 1006.393<br>
    </p>
    <p><br>
    </p>
    <p>so you have a 3D datum shift here. Not exactly the one you expect
      (not sure where your expected result comes from), but that's the
      best one we've available in our database, mostly driven by what
      there is in EPSG.</p>
    <p>As there are several iterations of the NAD83(CSRS) datum (the
      default one used in EPSG:2956, but also NAD83(CSRS)v2, v3, v4, v5,
      v6, v7), it is possible that your expected result is obtained with
      one of those later datums.</p>
    <p><br>
    </p>
    <p>API wise, you can get the 3D versions of the CRS with things like</p>
    <p>PJ* crs_2D = proj_create(ctxt, "EPSG:2956");</p>
    <p>PJ* crs_3D = proj_crs_promote_to_3D(ctxt, crs_2D); // in
      proj_experimental.h</p>
    <p>and then use proj_create_crs_to_crs_from_pj()</p>
    <p><br>
    </p>
    <p>Also note that the accuracy of the transformation is 1 meter, and
      that anything tagged EPSG:4326 has also a potential inaccuracy of
      2 meters.<br>
    </p>
    <p><br>
    </p>
    <p>Even<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 26/11/2021 à 18:03, Mathieu Poulin a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:YTXPR0101MB154910CE2168B8BBCE14C72D9B639@YTXPR0101MB1549.CANPRD01.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
        <div style="margin:0px;font-size:12pt;background-color:rgb(255,
          255, 255)"><span style="margin:0px;font-family:Calibri,
            Helvetica, sans-serif">When creating a transformation that
            requires a change of datum, it does not work. For instance,
            going from Geographic coordinates in WGS84 to UTM
            coordinates in NAD83CSRS. It does convert from geographic
            lat,lon to UTM projection easting,northing but the datum
            remains WGS84.</span><span
            style="margin:0px;font-family:"segoe ui
            westeuropean", "segoe ui", Helvetica, Arial,
            sans-serif"><br>
          </span><br>
          <span style="margin:0px;font-family:Calibri, Helvetica,
            sans-serif">I am using Proj 8.2 (but I've also tried this
            with Proj 7.1 and 7.2) with C++. Here is the code with
            comments describing the values of the variables, the
            expected output of the code and the actual output of the
            code.</span></div>
        <div style="margin:0px;font-size:12pt;background-color:rgb(255,
          255, 255)"><span style="margin:0px;font-family:Calibri,
            Helvetica, sans-serif"><br>
          </span></div>
        <div style="margin:0px;font-size:12pt;background-color:rgb(255,
          255, 255)"><span style="margin:0px;font-family:Calibri,
            Helvetica, sans-serif">// ENTRY: x=-1614798.938
            y=-3690228.026 z=4929942.509
            <div>GeographicLib::Geocentric::WGS84().Reverse(x, y, z,
              point.m_latitude, point.m_longitude,
              point.m_ellipsoidal_height);</div>
            <div>// REVERSE: point.m_latitude=50.937434634728845
              point.m_longitude=-113.63360224940385
              point.m_m_ellipsoidal_height=1005.9387180001410</div>
            <div>PJ_COORD coord = proj_coord(point.m_latitude,
              point.m_longitude, point.m_ellipsoidal_height, 0.0);</div>
            <div>PJ* proj_from_WGS84_to_2956 = proj_create_crs_to_crs(0,
              "EPSG:4326", "EPSG:2956", 0);</div>
            <div>PJ_XYZ proj_point_2 =
              proj_trans(proj_from_WGS84_to_2956, PJ_FWD, coord).xyz;</div>
            <div>// EXPECTED RESULT: 314967.330, 5646169.740, 1006.379</div>
            // ACTUAL RESULT:   314967.085, 5646169.595, 1005.939<br>
          </span></div>
        <div style="margin:0px;font-size:12pt;background-color:rgb(255,
          255, 255)"><span style="margin:0px;font-family:Calibri,
            Helvetica, sans-serif"><br>
          </span></div>
        <div style="margin:0px;font-size:12pt;background-color:rgb(255,
          255, 255)"><span style="margin:0px;font-family:Calibri,
            Helvetica, sans-serif">Am I doing something wrong? Am I
            missing something? If someone could help me out with this
            bit of code, it would be hugely appreciated.<br>
            <br>
            Thanks,</span></div>
        <div style="margin:0px;font-size:15px;font-family:"Segoe
          UI", "Segoe UI Web (West European)",
          "Segoe UI", -apple-system, BlinkMacSystemFont,
          Roboto, "Helvetica Neue", sans-serif;color:rgb(32,
          31, 30);background-color:rgb(255, 255, 255)">
          <div style="margin:0px;font-size:12pt;font-family:Calibri,
            Arial, Helvetica, sans-serif;color:rgb(0, 0, 0)">
            <div style="margin:0px"><br>
               - Mathieu Poulin</div>
          </div>
        </div>
        <br>
      </div>
      <div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div id="Signature">
          <div>
            <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
              font-size:12pt; color:rgb(0,0,0)">
              <p style="color:rgb(32,31,30); text-align:start;
                font-size:11pt; font-family:Calibri,sans-serif;
                background-color:white; margin:0px">
                <span style="margin:0px; color:black" lang="fr-CA"></span></p>
              <p style="color:rgb(32,31,30); font-size:11pt;
                background-color:white; margin:0px">
                <span style="margin:0px; color:black"></span></p>
              <p style="color:rgb(32,31,30); text-align:start;
                font-size:11pt; font-family:Calibri,sans-serif;
                background-color:white; margin:0px">
                <span style="margin:0px; font-size:10pt;
                  font-family:Arial,sans-serif; color:black"></span></p>
              <p style="margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; font-size:10pt;
                  font-family:Arial,sans-serif; color:black"></span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; font-size:10pt;
                  font-family:Arial,sans-serif; color:black"><img
                    size="0" tabindex="-1" style="margin:0px;
                    font-size:14.6667px; font-family:Calibri,sans-serif;
                    background-color:rgb(255,255,255); width:179.24pt;
                    height:93.74pt" data-outlook-trace="F:3|T:3"
                    src="cid:part1.9CC541C9.B722252C@spatialys.com"
                    class=""></span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR"> </span></p>
              <p style="font-size:14px; text-align:start;
                background:white"><b><span style="margin:0px;
                    padding:0cm; border:1pt none windowtext;
                    font-size:10pt; font-family:Arial,sans-serif;
                    color:black" lang="FR">Mathieu Poulin</span></b></p>
              <p style="font-size:14px; text-align:start;
                background:white"><b><span style="margin:0px;
                    font-size:10pt; font-family:Arial,sans-serif;
                    color:rgb(32,31,30)">Développeur | Developer</span></b></p>
              <p style="font-size:14px; text-align:start;
                background:white"><span style="margin:0px; padding:0cm;
                  border:1pt none windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">Division
                  arpentage et géomatique<br>
                </span><span style="margin:0px; font-size:10pt;
                  font-family:Arial,sans-serif; color:black">Département
                  Recherche et Développement</span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black"> </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">Siège
                  social</span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">15069,
                  boulevard Henri-Bourassa </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">Québec
                  (Québec) G1G 3Z5, Canada  </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">Tel :
                  1+(418) 641-0344</span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">Sans
                  frais: 1+ (888) 576-7898</span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <b><span style="margin:0px; padding:0cm; border:1pt none
                    windowtext; font-size:10pt;
                    font-family:Arial,sans-serif; color:rgb(13,13,13)"
                    lang="EN-CA"><a
                      href="http://www.mvtgeosolutions.com/"
                      target="_blank" style="margin:0px"
                      moz-do-not-send="true"><span style="margin:0px;
                        color:rgb(0,0,0)" lang="FR-CA">mvtgeosolutions.com</span></a></span></b></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(0,0,0)"> </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; color:black"><span
                    style="margin:0px; font-size:14.6667px;
                    font-family:Calibri,sans-serif; color:black"><a
                      href="https://www.facebook.com/mvtgeosolutions"
                      target="_blank" rel="noopener noreferrer"
                      style="margin:0px" moz-do-not-send="true"><span
                        style="margin:0px" lang="fr-CA"><img size="0"
                          tabindex="-1" style="margin:0px;
                          width:25.49pt; height:25.49pt"
                          data-outlook-trace="F:3|T:3"
                          src="cid:part3.898C5FBA.8A5B0041@spatialys.com"
                          class=""></span></a></span><span
                    style="margin:0px; font-size:14.6667px;
                    font-family:Calibri,sans-serif; color:rgb(32,31,30)"
                    lang="fr-CA">   <span style="margin:0px"> </span></span><span
                    style="margin:0px; font-size:14.6667px;
                    font-family:Calibri,sans-serif; color:black"><a
                      href="https://www.linkedin.com/company/mvtgeosolutions"
                      target="_blank" rel="noopener noreferrer"
                      style="margin:0px" moz-do-not-send="true"><span
                        style="margin:0px" lang="fr-CA"><img size="0"
                          tabindex="-1" style="margin:0px;
                          width:29.24pt; height:25.49pt"
                          data-outlook-trace="F:3|T:3"
                          src="cid:part5.8DE7D435.DFFBD679@spatialys.com"
                          class=""></span></a></span><span
                    style="margin:0px; font-size:14.6667px;
                    font-family:Calibri,sans-serif; color:rgb(32,31,30)"
                    lang="fr-CA">    </span><span style="margin:0px;
                    font-size:14.6667px; font-family:Calibri,sans-serif;
                    color:black"><a
                      href="https://www.youtube.com/channel/UCOFguYWgpbxOlKndKRqqRRQ"
                      target="_blank" rel="noopener noreferrer"
                      style="margin:0px" moz-do-not-send="true"><span
                        style="margin:0px" lang="fr-CA"><img size="0"
                          tabindex="-1" style="margin:0px;
                          width:25.49pt; height:25.49pt"
                          data-outlook-trace="F:3|T:3"
                          src="cid:part7.DB4CB87B.5933DFE3@spatialys.com"
                          class=""></span></a></span></span><span
                  style="margin:0px; color:black"><a
                    href="https://www.youtube.com/channel/UCOFguYWgpbxOlKndKRqqRRQ"
                    style="margin:0px" moz-do-not-send="true"><span
                      style="margin:0px; font-size:10pt;
                      font-family:Arial,sans-serif; color:blue"></span></a></span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR"> </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:black" lang="FR">  </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="FR">ATTENTION NOTICE </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="FR">  </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="FR">Les informations contenues dans le présent
                  message et dans toute pièce qui lui est jointe sont
                  confidentielles et peuvent être protégées par le
                  secret professionnel, industriel et/ou droits
                  d'auteurs. Ces informations sont à l'usage exclusif de
                  son ou de ses destinataires. Si vous avez reçu ce
                  message par mégarde, veuillez communiquer avec
                  l'expéditeur au +1 (888) 576-7898 poste 101, l'effacer
                  de tout disque dur ou autre média sur lequel il peut
                  être enregistré et ne pas en conserver de copie. </span><span
                  style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="EN-CA">Merci. </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="EN-CA"> </span></p>
              <p style="text-align:start; margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="EN-CA">This E-mail message and any attachment
                  thereto contain confidential information which may be
                  privileged, industrial secrets or copyrighted and
                  which is intended for the exclusive use of its
                  addressee(s). If you have received this communication
                  in error, please immediately notify us by telephone at
                  +1 (888) 576-7898 poste 101, erase it from any hard
                  disk or other medium on which it may have been saved
                  and do not keep any copy thereof. Thank you.</span><span
                  style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="FR"> </span></p>
              <p style="margin:0cm; font-size:11pt;
                font-family:Calibri,sans-serif; background:white">
                <span style="margin:0px; padding:0cm; border:1pt none
                  windowtext; font-size:10pt;
                  font-family:Arial,sans-serif; color:rgb(118,113,113)"
                  lang="FR"></span></p>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></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>