diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/pj_obs_api_test.c | 33 | ||||
| -rw-r--r-- | examples/s45b.pol | 402 |
2 files changed, 418 insertions, 17 deletions
diff --git a/examples/pj_obs_api_test.c b/examples/pj_obs_api_test.c index c75b4a21..bb792c62 100644 --- a/examples/pj_obs_api_test.c +++ b/examples/pj_obs_api_test.c @@ -44,8 +44,6 @@ int pj_pipeline_selftest (void); - - int main (void) { PJ *P; PJ_OBS a, b; @@ -71,7 +69,7 @@ int main (void) { return puts ("Oops"), 0; /* zero initialize everything, then set (longitude, latitude) to (12, 55) */ - a = pj_obs_null; + a = pj_obs_null (); /* a.coo.lp: The coordinate part of a, interpreted as a classic LP pair */ a.coo.lp.lam = TORAD(12); a.coo.lp.phi = TORAD(55); @@ -100,13 +98,12 @@ int main (void) { dist = pj_xyz_dist (a.coo.xyz, b.coo.xyz); printf ("Roundtrip deviation, (nm): %15.9f\n", dist*1e9); - /* Invalid projection */ a = pj_trans (P, 42, a); if (a.coo.lpz.lam!=DBL_MAX) printf ("%15.9f %15.9f\n", a.coo.lpz.lam, a.coo.lpz.phi); - err = pj_error (P); - printf ("pj_error: %d\n", err); + err = pj_err_level (P, PJ_ERR_TELL); + printf ("pj_err_level: %d\n", err); /* Clean up */ pj_free (P); @@ -117,7 +114,7 @@ int main (void) { return puts ("Oops"), 0; /* zero initialize everything, then set (longitude, latitude, height) to (12, 55, 100) */ - a = b = pj_obs_null; + a = b = pj_obs_null (); a.coo.lpz.lam = TORAD(12); a.coo.lpz.phi = TORAD(55); a.coo.lpz.z = 100; @@ -152,17 +149,18 @@ int main (void) { P I P E L I N E T E S T S - **************************************************************************** - - ***************************************************************************/ /* forward-reverse geo->utm->geo */ - P = pj_create ("+proj=pipeline +ellps=GRS80 +zone=32 +step +proj=utm +step +proj=utm +inv"); + P = pj_create ( + "+proj=pipeline +ellps=GRS80 +zone=32 +step " + "+proj=utm +step " + "+proj=utm +inv" + ); if (0==P) return puts ("Oops"), 0; /* zero initialize everything, then set (longitude, latitude, height) to (12, 55, 100) */ - a = b = pj_obs_null; + a = b = pj_obs_null (); a.coo.lpz.lam = TORAD(12); a.coo.lpz.phi = TORAD(55); a.coo.lpz.z = 100; @@ -180,12 +178,15 @@ int main (void) { /* And now the back-to-back situation utm->geo->utm */ - P = pj_create ("+proj=pipeline +ellps=GRS80 +zone=32 +step +proj=utm +inv +step +proj=utm"); + P = pj_create ( + "+proj=pipeline +ellps=GRS80 +zone=32 +step " + "+proj=utm +inv +step " + "+proj=utm"); if (0==P) return puts ("Oops"), 0; /* zero initialize everything, then set (easting, northing) to utm(12, 55) */ - a = b = pj_obs_null; + a = b = pj_obs_null (); a.coo.xy = cph_utm32; printf ("PRE: %15.9f %15.9f\n", a.coo.xy.x, a.coo.xy.y); @@ -207,7 +208,7 @@ int main (void) { return puts ("Oops"), 0; /* zero initialize everything, then set (easting, northing) to utm(12, 55) */ - a = b = pj_obs_null; + a = b = pj_obs_null (); a.coo.lpz.lam = TORAD(12); a.coo.lpz.phi = TORAD(55); printf ("PRE: %15.9f %15.9f\n", TODEG(a.coo.lp.lam), TODEG(a.coo.lp.phi)); @@ -221,7 +222,6 @@ int main (void) { a = pj_trans (P, PJ_INV, b); printf ("INV: %15.9f %15.9f\n", TODEG(a.coo.lp.lam), TODEG(a.coo.lp.phi)); - /* Geodesic distance between two points with angular 2D coordinates */ a.coo.lp.lam = TORAD(12); a.coo.lp.phi = TORAD(60); @@ -237,7 +237,6 @@ int main (void) { dist = pj_lp_dist (P, a.coo.lp, b.coo.lp); printf ("1 deg at Equator: %15.9f\n", dist); - pj_free (P); pj_pipeline_selftest (); return 0; diff --git a/examples/s45b.pol b/examples/s45b.pol new file mode 100644 index 00000000..9b70fbf7 --- /dev/null +++ b/examples/s45b.pol @@ -0,0 +1,402 @@ +################################################################################ +# +# Horner polynomial evaluation demo data +# +################################################################################ +# +# These are the polynomial coefficients used for transforming to and from +# the Danish legacy system s45b "System 45 Bornholm" +# +################################################################################ + +<s45b> +proj=pipeline + +step init=./s45b.pol:s45b_tc32 +# step init=./s45b.pol:tc32_utm32 + +step proj=utm inv ellps=intl zone=32 +step proj=cart ellps=intl + +step proj=helmert ellps=GRS80 + x=-81.0703 y=-89.3603 z=-115.7526 + rx=-484.88 ry=-24.36 rz=-413.21 s=-0.540645 + +step proj=cart inv ellps=GRS80 +step proj=utm ellps=GRS80 zone=32 + + + + +################################################################################ +# +# S 4 5 B -> T C 3 2 +# +################################################################################ +<s45b_tc32> + +proj=horner +ellps=intl +range=500000 + +fwd_origin=47022.563745,51779.260103 +inv_origin=878354.943082,6125305.175366 +deg=6 + + +# static double C_ttb[] +# tc32_ed50 -> s45b +# m_lim_gen: 0.153 red = 0 OBS = 1074 +# m = 1.51 cm my_loss = +3 y_enp = +8.4 +# m = 1.53 cm mx_loss = +4 x_enp = +8.4 + +# mht C_ttb er +# fwd-inv ombyttet ifht original Poder/Engsager-kode +# For at opnå at to fwd transform fører fra s45b->tc32->utm32 (->ETRS89) + +inv_v=\ +# Poly NORTH :: e-degree = 0 : n-degree = 6 + 5.1779004699e+04,\ + 9.9508320295e-01,\ + -2.9453823207e-10,\ + 1.9995084102e-14,\ + -1.4895751366e-18,\ + -9.9734812211e-23,\ + 1.1194218845e-26,\ + +# Poly NORTH :: e-degree = 1 : n-degree = 5 + -8.4285679515e-02,\ + -7.9623049286e-09,\ + -3.7190046062e-14,\ + -2.3324127411e-18,\ + -1.1150449763e-22,\ + 2.8703154270e-27,\ + +# Poly NORTH :: e-degree = 2 : n-degree = 4 + 8.7160434140e-10,\ + -3.3634602927e-14,\ + -5.5718245313e-18,\ + 6.2611750909e-23,\ + -2.1011243838e-26,\ + +# Poly NORTH :: e-degree = 3 : n-degree = 3 + 1.0905463989e-14,\ + -4.3960034360e-18,\ + 3.6121595001e-22,\ + -1.3493066011e-27,\ + +# Poly NORTH :: e-degree = 4 : n-degree = 2 + -1.3360171462e-18,\ + 1.0780850646e-22,\ + 4.5118286607e-26,\ + +# Poly NORTH :: e-degree = 5 : n-degree = 1 + -1.3718883973e-22,\ + 1.6263920750e-26,\ + +# Poly NORTH :: e-degree = 6 : n-degree = 0 + -5.1004217526e-27 + +# tcy 6125305.175366 + +inv_u=\ +# Poly EAST :: n-degree = 0 : e-degree = 6 + 4.7022495967e+04,\ + -9.9508282498e-01,\ + 3.2436283039e-09,\ + -2.6276394334e-15,\ + 8.6318533291e-18,\ + -3.8327518550e-23,\ + -2.5704924282e-26,\ + +# Poly EAST :: n-degree = 1 : e-degree = 5 + -8.4285975934e-02,\ + 5.7098765263e-10,\ + -6.0863955939e-14,\ + 2.3608788740e-18,\ + 6.8899581969e-24,\ + -1.1429511179e-26,\ + +# Poly EAST :: n-degree = 2 : e-degree = 4 + -4.6079778412e-09,\ + 1.5072604543e-14,\ + 5.4063862378e-18,\ + 1.2591327827e-22,\ + 7.9336388691e-27,\ + +# Poly EAST :: n-degree = 3 : e-degree = 3 + -2.9479268638e-14,\ + 1.7090049434e-18,\ + 2.8413337985e-22,\ + -3.3577391552e-27,\ + +# Poly EAST :: n-degree = 4 : e-degree = 2 + 3.0434879273e-18,\ + -1.8081673510e-22,\ + -2.3651419850e-26,\ + +# Poly EAST :: n-degree = 5 : e-degree = 1 + 9.2060044804e-23,\ + 3.7807953325e-27,\ + +# Poly EAST :: n-degree = 6 : e-degree = 0 + -4.9415665221e-27 + +# tcx 878354.943082 + + +# static double C_btt[] +# s45b -> tc32_ed50 +# m_lim_gen: 0.154 red = 0 OBS = 1074 +# m = 1.50 cm my_loss = +3 y_enp = +8.5 +# m = 1.54 cm mx_loss = +4 x_enp = +8.3 + +fwd_v=\ +# Poly NORTH :: e-degree = 0 : n-degree = 6 + 6.1253054245e+06,\ + 9.9778251908e-01,\ + -7.7346152025e-10,\ + -2.5359789369e-14,\ + 1.5614918228e-18,\ + 9.8091134295e-23,\ + -1.1092581145e-26,\ + +# Poly NORTH :: e-degree = 1 : n-degree = 5 + -8.4514352088e-02,\ + -7.9847579284e-09,\ + -2.6865560962e-14,\ + -2.0731372756e-18,\ + -1.3660341123e-22,\ + 1.1244836340e-26,\ + +# Poly NORTH :: e-degree = 2 : n-degree = 4 + 8.0551988135e-11,\ + 3.6661500679e-14,\ + 5.4247705403e-18,\ + 8.4494604807e-23,\ + 1.3334858516e-26,\ + +# Poly NORTH :: e-degree = 3 : n-degree = 3 + 8.3889821184e-15,\ + -4.8124202237e-18,\ + 2.9088188830e-22,\ + -2.0129874264e-26,\ + +# Poly NORTH :: e-degree = 4 : n-degree = 2 + 2.4716463766e-18,\ + -2.1717177513e-22,\ + -3.2828537638e-26,\ + +# Poly NORTH :: e-degree = 5 : n-degree = 1 + -1.2080655753e-22,\ + 2.5050435391e-26,\ + +# Poly NORTH :: e-degree = 6 : n-degree = 0 + 1.1383483826e-27 + +# tcy 51779.260103, + +fwd_u=\ +# Poly EAST :: n-degree = 0 : e-degree = 6 + 8.7835485387e+05,\ + -9.9778289691e-01,\ + 3.2537215213e-09,\ + 6.9217640616e-15,\ + 8.6268883840e-18,\ + 4.6748156909e-23,\ + -2.6492402009e-26,\ + +# Poly EAST :: n-degree = 1 : e-degree = 5 + -8.4514648771e-02,\ + 1.4399520180e-09,\ + -6.0423329711e-14,\ + 6.9816167332e-20,\ + 6.7729233542e-23,\ + -5.3308251880e-27,\ + +# Poly EAST :: n-degree = 2 : e-degree = 4 + -4.5697800099e-09,\ + -1.5194038814e-14,\ + 5.1112653016e-18,\ + -2.0307532869e-22,\ + 1.0374125432e-26,\ + +# Poly EAST :: n-degree = 3 : e-degree = 3 + -2.8983003841e-14,\ + -1.6414425785e-18,\ + 1.7874983379e-22,\ + 1.5492164174e-26,\ + +# Poly EAST :: n-degree = 4 : e-degree = 2 + 2.7919197366e-18,\ + 1.9218613279e-22,\ + -2.1007264634e-26,\ + +# Poly EAST :: n-degree = 5 : e-degree = 1 + 1.0032412389e-22,\ + -5.9007997846e-27,\ + +# Poly EAST :: n-degree = 6 : e-degree = 0 + -4.4410970979e-27 + +# tcx 47022.563745 + + + + + +################################################################################ +# +# T C 3 2 -> U T M 3 2 +# +################################################################################ + +<tc32_utm32> + +proj=horner +ellps=intl +range=500000 + + +fwd_origin=877605.269066,6125810.306769 +inv_origin=877605.760036,6125811.281773 + + +# tc32_ed50 -> utm32_ed50 : Bornholm + +deg=4 + +# ttu_n and ttu_e are based on static double C_ttu_b[] +# m_lim_gen: 0.086 red = 0 OBS = 852 +# m = 1.38 cm my_loss = +2 y_enp = +10.5 +# m = 1.44 cm mx_loss = +2 x_enp = +10.4 +# static double ttu_n[] + +fwd_v=\ +# Poly NORTH :: e-degree = 0 : n-degree = 0..4 + 6.1258112678e+06,\ + 9.9999971567e-01,\ + 1.5372750011e-10,\ + 5.9300860915e-15,\ + 2.2609497633e-19,\ + +# Poly NORTH :: e-degree = 1 : n-degree = 0..3 + 4.3188227445e-05,\ + 2.8225130416e-10,\ + 7.8740007114e-16,\ + -1.7453997279e-19,\ + +# Poly NORTH :: e-degree = 2 : n-degree = 0..2 + 1.6877465415e-10,\ + -1.1234649773e-14,\ + -1.7042333358e-18,\ + +# Poly NORTH :: e-degree = 3 : n-degree = 0..1 + -7.9303467953e-15,\ + -5.2906832535e-19,\ + +# Poly NORTH :: e-degree = 4 : n-degree = 0 + 3.9984284847e-19 + +# tcy 6125810.306769 + + + +# static double ttu_e[] +fwd_u=\ +# Poly EAST :: n-degree = 0 : e-degree = 0..4 + 8.7760574982e+05,\ + 9.9999752475e-01,\ + 2.8817299305e-10,\ + 5.5641310680e-15,\ + -1.5544700949e-18,\ + +# Poly EAST :: n-degree = 1 : e-degree = 3 + -4.1357045890e-05,\ + 4.2106213519e-11,\ + 2.8525551629e-14,\ + -1.9107771273e-18,\ + +# Poly EAST :: n-degree = 2 : e-degree = 2 + 3.3615590093e-10,\ + 2.4380247154e-14,\ + -2.0241230315e-18,\ + +# Poly EAST :: n-degree = 3 : e-degree = 1 + 1.2429019719e-15,\ + 5.3886155968e-19,\ + +# Poly EAST :: n-degree = 4 : e-degree = 0 + -1.0167505000e-18 + +# tcx 877605.760036 + + +# utt_n and utt_e are based on static double C_utt_b[] +# utm32_ed50 -> tc32_ed50 : Bornholm +# m_lim_gen: 0.086 red = 0 OBS = 852 +# m = 1.38 cm my_loss = +2 y_enp = +10.8 +# m = 1.44 cm mx_loss = +2 x_enp = +10.7 +# static double utt_n[] + +inv_v=\ +# Poly NORTH :: e-degree = 0 : n-degree = 4 + 6.1258103208e+06,\ + 1.0000002826e+00,\ + -1.5372762184e-10,\ + -5.9304261011e-15,\ + -2.2612705361e-19,\ + +# Poly NORTH :: e-degree = 1 : n-degree = 3 + -4.3188331419e-05,\ + -2.8225549995e-10,\ + -7.8529116371e-16,\ + 1.7476576773e-19,\ + +# Poly NORTH :: e-degree = 2 : n-degree = 2 + -1.6875687989e-10,\ + 1.1236475299e-14,\ + 1.7042518057e-18,\ + +# Poly NORTH :: e-degree = 3 : n-degree = 1 + 7.9300735257e-15,\ + 5.2881862699e-19,\ + +# Poly NORTH :: e-degree = 4 : n-degree = 0 + -3.9990736798e-19 + +# tcy 6125811.281773 + + + + +# static double utt_e[] +inv_u=\ +# Poly EAST :: n-degree = 0 : e-degree = 0..4 + 8.7760527928e+05,\ + 1.0000024735e+00,\ + -2.8817540032e-10,\ + -5.5627059451e-15,\ + 1.5543637570e-18,\ + +# Poly EAST :: n-degree = 1 : e-degree = 0..3 + 4.1357152105e-05,\ + -4.2114813612e-11,\ + -2.8523713454e-14,\ + 1.9109017837e-18,\ + +# Poly EAST :: n-degree = 2 : e-degree = 0..2 + -3.3616407783e-10,\ + -2.4382678126e-14,\ + 2.0245020199e-18,\ + +# Poly EAST :: n-degree = 3 : e-degree = 0..1 + -1.2441377565e-15,\ + -5.3885232238e-19,\ + +# Poly EAST :: n-degree = 4 : e-degree = 0 + 1.0167203661e-18 + +# tcx 877605.760036 + +<> |
