aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_pipeline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/PJ_pipeline.c')
-rw-r--r--src/PJ_pipeline.c124
1 files changed, 0 insertions, 124 deletions
diff --git a/src/PJ_pipeline.c b/src/PJ_pipeline.c
index 0729b1da..e1568423 100644
--- a/src/PJ_pipeline.c
+++ b/src/PJ_pipeline.c
@@ -444,127 +444,3 @@ PJ *OPERATION(pipeline,0) {
return P;
}
-#ifndef PJ_SELFTEST
-/* selftest stub */
-int pj_pipeline_selftest (void) {return 0;}
-#else
-
-int pj_pipeline_selftest (void) {
- PJ *P;
- PJ_COORD a, b;
- XY cph_utm32 = {691875.63214, 6098907.82501};
- double dist;
-
- /* forward-reverse geo->utm->geo */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=pipeline +zone=32 +step +proj=utm +ellps=GRS80 +step +proj=utm +ellps=GRS80 +inv");
- if (0==P)
- return 1000;
- /* zero initialize everything, then set (longitude, latitude, height) to (12, 55, 0) */
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(12);
- a.lpz.phi = PJ_TORAD(55);
- a.lpz.z = 10;
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- if (proj_lp_dist (P, a.lp, b.lp) > 1e-4)
- return 1001;
-
- /* Inverse projection (still same result: pipeline is symmetrical) */
- a = proj_trans (P, PJ_INV, b);
- if (proj_lp_dist (P, a.lp, b.lp) > 1e-4)
- return 1002;
-
- proj_destroy (P);
-
- /* And now the back-to-back situation utm->geo->utm */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=pipeline +zone=32 +step +proj=utm +ellps=GRS80 +inv +step +proj=utm +ellps=GRS80");
- if (0==P)
- return 2000;
-
- /* zero initialize everything, then set (easting, northing) to utm(12, 55) */
- a = b = proj_coord (0,0,0,0);
- a.xy = cph_utm32;
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- if (proj_xy_dist (a.xy, b.xy) > 1e-4)
- return 2001;
-
- /* Inverse projection */
- a = proj_trans (P, PJ_INV, b);
- if (proj_xy_dist (a.xy, b.xy) > 1e-4)
- return 2001;
- if (proj_xyz_dist (a.xyz, b.xyz) > 1e-4)
- return 2002;
-
- proj_destroy (P);
-
-
- /* Finally testing a corner case: A rather pointless one-step pipeline geo->utm */
- P = proj_create (PJ_DEFAULT_CTX, "+proj=pipeline +zone=32 +step +proj=utm +ellps=GRS80 ");
- if (0==P)
- return 3000;
-
-
- a = b = proj_coord (0,0,0,0);
- a.lpz.lam = PJ_TORAD(12);
- a.lpz.phi = PJ_TORAD(55);
-
- /* Forward projection */
- b = proj_trans (P, PJ_FWD, a);
- if (proj_xy_dist (cph_utm32, b.xy) > 1e-4)
- return 3001;
-
- /* Inverse projection */
- b = proj_trans (P, PJ_INV, b);
- if (proj_lp_dist (P, a.lp, b.lp) > 1e-4)
- return 3002;
-
-
- /* Since we use pj_lp_dist to determine success above, we should also test that it works */
-
- /* Geodesic distance between two points with angular 2D coordinates */
- a.lp.lam = PJ_TORAD(12);
- a.lp.phi = PJ_TORAD(60);
- b.lp.lam = PJ_TORAD(12);
- b.lp.phi = PJ_TORAD(61);
- dist = proj_lp_dist (P, a.lp, b.lp);
- if (fabs (111420.727870234 - dist) > 1e-4)
- return 4001;
-
- a.lp.lam = PJ_TORAD(12);
- a.lp.phi = PJ_TORAD(0.);
- b.lp.lam = PJ_TORAD(12);
- b.lp.phi = PJ_TORAD(1.);
- dist = proj_lp_dist (P, a.lp, b.lp);
- if (fabs (110574.388554153 - dist) > 1e-4)
- return 4002;
-
- proj_destroy (P);
-
- /* test a pipeline with several +init steps */
- P = proj_create(
- 0,
- "+proj=pipeline "
- "+step +init=epsg:25832 +inv "
- "+step +init=epsg:25833 "
- "+step +init=epsg:25833 +inv "
- "+step +init=epsg:25832 "
- );
- if (0==P)
- return 5000;
-
- a.xy.x = 700000.0;
- a.xy.y = 6000000.0;
-
- b = proj_trans(P, PJ_FWD, a);
- dist = proj_xy_dist(a.xy, b.xy);
- if (dist > 1e-7)
- return 5001;
-
-
- proj_destroy (P);
- return 0;
-}
-#endif