diff options
| author | Charles Karney <ckarney@karney.com> | 2015-10-24 11:36:25 -0400 |
|---|---|---|
| committer | Charles Karney <ckarney@karney.com> | 2015-10-24 11:36:25 -0400 |
| commit | b0fb037ea22e2e9452feda502455ac6110c3e1e3 (patch) | |
| tree | 9894bb2f23bb430641bf954976c4dbdf911e3a72 /src | |
| parent | f4b687baa69f7f76b0fc9ce5970890285090db9e (diff) | |
| download | PROJ-b0fb037ea22e2e9452feda502455ac6110c3e1e3.tar.gz PROJ-b0fb037ea22e2e9452feda502455ac6110c3e1e3.zip | |
Switch utm to use etmerc to address issue #316.
Add a test to check this. Output of an existing test changed in 7th
decimal place.
Diffstat (limited to 'src')
| -rw-r--r-- | src/PJ_tmerc.c | 22 | ||||
| -rw-r--r-- | src/proj_etmerc.c | 33 | ||||
| -rw-r--r-- | src/projects.h | 2 |
3 files changed, 32 insertions, 25 deletions
diff --git a/src/PJ_tmerc.c b/src/PJ_tmerc.c index 3b1e0fb5..70e8e72f 100644 --- a/src/PJ_tmerc.c +++ b/src/PJ_tmerc.c @@ -5,8 +5,6 @@ #define PJ_LIB__ #include <projects.h> PROJ_HEAD(tmerc, "Transverse Mercator") "\n\tCyl, Sph&Ell"; -PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") - "\n\tCyl, Sph\n\tzone= south"; #define EPS10 1.e-10 #define aks0 P->esp #define aks5 P->ml0 @@ -153,23 +151,3 @@ setup(PJ *P) { /* general initialization */ } ENTRY1(tmerc, en) ENDENTRY(setup(P)) -ENTRY1(utm, en) - int zone; - - if (!P->es) E_ERROR(-34); - P->y0 = pj_param(P->ctx, P->params, "bsouth").i ? 10000000. : 0.; - P->x0 = 500000.; - if (pj_param(P->ctx, P->params, "tzone").i) /* zone input ? */ - if ((zone = pj_param(P->ctx, P->params, "izone").i) > 0 && zone <= 60) - --zone; - else - E_ERROR(-35) - else /* nearest central meridian input */ - if ((zone = floor((adjlon(P->lam0) + PI) * 30. / PI)) < 0) - zone = 0; - else if (zone >= 60) - zone = 59; - P->lam0 = (zone + .5) * PI / 30. - PI; - P->k0 = 0.9996; - P->phi0 = 0.; -ENDENTRY(setup(P)) diff --git a/src/proj_etmerc.c b/src/proj_etmerc.c index 1097eb3c..a5351f5d 100644 --- a/src/proj_etmerc.c +++ b/src/proj_etmerc.c @@ -52,6 +52,8 @@ PROJ_HEAD(etmerc, "Extended Transverse Mercator") "\n\tCyl, Sph\n\tlat_ts=(0)\nlat_0=(0)"; +PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") + "\n\tCyl, Sph\n\tzone= south"; #define PROJ_ETMERC_ORDER 6 @@ -211,7 +213,8 @@ INVERSE(e_inverse); /* ellipsoid */ FREEUP; if (P) free(P); } -ENTRY0(etmerc) + static PJ * +setup(PJ *P) { /* general initialization */ double f, n, np, Z; if (P->es <= 0) E_ERROR(-34); @@ -286,4 +289,30 @@ ENTRY0(etmerc) P->Zb = - P->Qn*(Z + clens(P->gtu, PROJ_ETMERC_ORDER, 2*Z)); P->inv = e_inverse; P->fwd = e_forward; -ENDENTRY(P) + return P; +} + +ENTRY0(etmerc) +ENDENTRY(setup(P)) + +/* utm uses etmerc for the underlying projection */ +ENTRY0(utm) + int zone; + + if (!P->es) E_ERROR(-34); + P->y0 = pj_param(P->ctx, P->params, "bsouth").i ? 10000000. : 0.; + P->x0 = 500000.; + if (pj_param(P->ctx, P->params, "tzone").i) /* zone input ? */ + if ((zone = pj_param(P->ctx, P->params, "izone").i) > 0 && zone <= 60) + --zone; + else + E_ERROR(-35) + else /* nearest central meridian input */ + if ((zone = floor((adjlon(P->lam0) + PI) * 30. / PI)) < 0) + zone = 0; + else if (zone >= 60) + zone = 59; + P->lam0 = (zone + .5) * PI / 30. - PI; + P->k0 = 0.9996; + P->phi0 = 0.; +ENDENTRY(setup(P)) diff --git a/src/projects.h b/src/projects.h index fe6a44c6..43287849 100644 --- a/src/projects.h +++ b/src/projects.h @@ -316,7 +316,7 @@ extern struct PJ_PRIME_MERIDIANS pj_prime_meridians[]; #endif #ifdef PJ_LIB__ - /* repeatative projection code */ + /* repetitive projection code */ #define PROJ_HEAD(id, name) static const char des_##id [] = name #define ENTRYA(name) \ C_NAMESPACE_VAR const char * const pj_s_##name = des_##name; \ |
