[PROJ] Change of datum not working

Mathieu Poulin mathieu.poulin at mvtgeosolutions.com
Fri Nov 26 09:03:18 PST 2021


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.

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.

// ENTRY: x=-1614798.938 y=-3690228.026 z=4929942.509
GeographicLib::Geocentric::WGS84().Reverse(x, y, z, point.m_latitude, point.m_longitude, point.m_ellipsoidal_height);
// REVERSE: point.m_latitude=50.937434634728845 point.m_longitude=-113.63360224940385 point.m_m_ellipsoidal_height=1005.9387180001410
PJ_COORD coord = proj_coord(point.m_latitude, point.m_longitude, point.m_ellipsoidal_height, 0.0);
PJ* proj_from_WGS84_to_2956 = proj_create_crs_to_crs(0, "EPSG:4326", "EPSG:2956", 0);
PJ_XYZ proj_point_2 = proj_trans(proj_from_WGS84_to_2956, PJ_FWD, coord).xyz;
// EXPECTED RESULT: 314967.330, 5646169.740, 1006.379
// ACTUAL RESULT:   314967.085, 5646169.595, 1005.939

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.

Thanks,

 - Mathieu Poulin



[cid:b842d2e7-e23d-4c75-9eb0-6cdf834de5b1]



Mathieu Poulin

Développeur | Developer

Division arpentage et géomatique
Département Recherche et Développement



Siège social

15069, boulevard Henri-Bourassa

Québec (Québec) G1G 3Z5, Canada

Tel : 1+(418) 641-0344

Sans frais: 1+ (888) 576-7898

mvtgeosolutions.com<http://www.mvtgeosolutions.com/>



[cid:ab93d6d0-85d4-4ebe-8af2-044e71f94958]<https://www.facebook.com/mvtgeosolutions>    [cid:a54b447d-ac65-4951-8fcf-d10c737d0c3a] <https://www.linkedin.com/company/mvtgeosolutions>     [cid:cfbd29c9-c9c3-4973-afce-0be0062013bb] <https://www.youtube.com/channel/UCOFguYWgpbxOlKndKRqqRRQ> <https://www.youtube.com/channel/UCOFguYWgpbxOlKndKRqqRRQ>





ATTENTION NOTICE



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. Merci.



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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211126/8d89041f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-31dfdvgz.png
Type: image/png
Size: 8696 bytes
Desc: Outlook-31dfdvgz.png
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211126/8d89041f/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-gxopdjhy.png
Type: image/png
Size: 1444 bytes
Desc: Outlook-gxopdjhy.png
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211126/8d89041f/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-aio4tfz2.png
Type: image/png
Size: 880 bytes
Desc: Outlook-aio4tfz2.png
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211126/8d89041f/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-ccv4tpf3.png
Type: image/png
Size: 1584 bytes
Desc: Outlook-ccv4tpf3.png
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211126/8d89041f/attachment-0007.png>


More information about the PROJ mailing list