<div dir="ltr">Hello Roger,<br><br>If you use the "proj" command line application, you get the expected value:<br><br><font face="monospace">$ echo 13.100962  55.600783 | proj -V +proj=tmerc +lon_0=15 +k_0=0.9996 +x_0=500000<br>#Transverse Mercator<br>#       Cyl, Sph&Ell<br>#       approx<br># +proj=tmerc +lon_0=15 +k_0=0.9996 +x_0=500000 +break_cs2cs_recursion<br># +ellps=GRS80<br>#Final Earth figure: ellipsoid<br>#  Major axis (a): 6378137.000<br>#  1/flattening: 298.257222<br>#  squared eccentricity: 0.006694380023<br><br>Longitude: 13d6'3.463"E [ 13.100962 ]<br>Latitude:  55d36'2.819"N [ 55.600783 ]<br>Easting (x):   380351.08<br>Northing (y):  6163285.60<br>Meridian scale (h) : 0.99977560  ( -0.02244 % error )<br>Parallel scale (k) : 0.99977560  ( -0.02244 % error )<br>Areal scale (s):     0.99955126  ( -0.04487 % error )<br>Angular distortion (w): 0.000<br>Meridian/Parallel angle: 90.00000<br>Convergence : -1d34'1.635" [ -1.56712087 ]<br>Max-min (Tissot axis a-b) scale error: 0.99978 0.99978<br></font><br>The differing results from your code may be a matter of your PR instantiation leading to taking the code branch in <a href="https://github.com/OSGeo/PROJ/blob/ced8793aa170dd4792f331633e62726808a2e75d/src/4D_api.cpp#L2469">https://github.com/OSGeo/PROJ/blob/ced8793aa170dd4792f331633e62726808a2e75d/src/4D_api.cpp#L2469</a><br><br>Could you try to instantiate a plain, classic PROJ PJ using<div>    proj_create("proj=tmerc lon_0=15 k_0=0.9996 x_0=500000 ellps=GRS80"),</div><div>then calling proj_factors with that as input. It should send you through the code branch at <a href="https://github.com/OSGeo/PROJ/blob/ced8793aa170dd4792f331633e62726808a2e75d/src/4D_api.cpp#L2499">https://github.com/OSGeo/PROJ/blob/ced8793aa170dd4792f331633e62726808a2e75d/src/4D_api.cpp#L2499</a> which may (or may not) give you the result you expect. </div><div><br></div><div>If it doesn't, please file a ticket over at <a href="https://github.com/OSGeo/PROJ/issues">https://github.com/OSGeo/PROJ/issues</a><br><br></div><div>/Thomas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den ons. 1. jun. 2022 kl. 11.49 skrev Roger Oberholtzer <<a href="mailto:roger.oberholtzer@gmail.com">roger.oberholtzer@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am trying to determine the meridian convergence for a point. The<br>
projection is defined as:<br>
<br>
PJ *proj = proj_normalize_for_visualization(0,<br>
           proj_create_crs_to_crs(0, "EPSG:4326", "EPSG:3006", 0));<br>
<br>
The source lat/longs are wgs84 from a GPS receiver. The projection is<br>
Sweref99. That is working just fine. In my case, the LONG/LAT are in<br>
degrees.<br>
<br>
       PJ_COORD ivals, vals;<br>
       vals.xyz.x = LONG;<br>
       vals.xyz.y = LAT;<br>
       vals.xyz.z = HEIGHT;<br>
       ivals = proj_trans(tinfo->Proj, PJ_FWD, vals);<br>
<br>
So far, so good.<br>
<br>
I need to do some rotations of the projected points. Towards that end,<br>
I would like to determine the meridian convergence. I am expecting to<br>
use this as a correction to a yaw value that my GPS receiver also<br>
provides via an integrated IMU.<br>
<br>
       PJ_FACTORS factors;<br>
<br>
       vals.lp.lam = proj_torad(LONG);<br>
       vals.lp.phi = proj_torad(LAT);<br>
<br>
       factors = proj_factors(tinfo->Proj, vals);<br>
<br>
I must be doing something incorrectly, as I get similar results for<br>
data from different locations. Or I am missing a step. Or I am just<br>
doing something totally wrong.<br>
<br>
Data from west of the Sweref99 central meridian (convergence should be<br>
-1.56713° according to the Swedish authority):<br>
<br>
LAT 55.600783<br>
LONG 13.100962<br>
ALT 13.463000<br>
E 380351.081178<br>
N 6163285.609844<br>
angular_distortion 0.567652<br>
meridian_parallel_angle 1.570796<br>
meridian_convergence -0.004468<br>
<br>
Data from east of the Sweref99 central meridian (convergence should be<br>
0.40007° according to the Swedish authority):<br>
<br>
LAT 58.618118<br>
LONG 15.468616<br>
ALT 79.686000<br>
E 527220.410693<br>
N 6497625.569591<br>
angular_distortion 0.645715<br>
meridian_parallel_angle 1.570796<br>
meridian_convergence -0.004696<br>
<br>
angular_distortion, meridian_parallel_angle, and meridian_convergence<br>
are the values returned by proj_factors().<br>
<br>
This is with proj 8.2.1 on Linux. It is generally working fine. It's just this.<br>
<br>
Any pointers would be greatly appreciated.<br>
<br>
-- <br>
Roger Oberholtzer<br>
_______________________________________________<br>
PROJ mailing list<br>
<a href="mailto:PROJ@lists.osgeo.org" target="_blank">PROJ@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/proj" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/proj</a><br>
</blockquote></div>