From 08f0548cc6e34756a081ec0e01e82560170cb599 Mon Sep 17 00:00:00 2001 From: Ivan Veselov Date: Tue, 9 Oct 2018 21:57:06 +0100 Subject: [PATCH] Remove +scale parameter in favour of good old +k_0 --- docs/source/operations/projections/lcc.rst | 8 +++----- src/PJ_lcc.c | 13 ++++--------- test/gie/builtins.gie | 6 +++--- test/gie/more_builtins.gie | 2 +- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/docs/source/operations/projections/lcc.rst b/docs/source/operations/projections/lcc.rst index 48f715085c..27cf6555ee 100644 --- a/docs/source/operations/projections/lcc.rst +++ b/docs/source/operations/projections/lcc.rst @@ -12,7 +12,7 @@ seven projections introduced by Johann Heinrich Lambert in 1772. It has several different forms: with one and two standard parallels (referred to as 1SP and 2SP in EPSG guidance notes). Additionally we provide "2SP Michigan" form which is very similar to normal 2SP, but -with a scaling factor on the ellipsoid (given as `scale` parameter). +with a scaling factor on the ellipsoid (given as `k_0` parameter). It is implemented as per EPSG Guidance Note 7-2 (version 54, August 2018, page 25). It is used in a few systems in the EPSG database which justifies adding this otherwise non-standard projection. @@ -23,7 +23,7 @@ justifies adding this otherwise non-standard projection. | **Available forms** | Forward and inverse, spherical and elliptical projection.| | | One or two standard parallels (1SP and 2SP). | | | "LCC 2SP Michigan" form can be used by setting | -| | `+scale` parameter to specify elliposid scale. | +| | `+k_0` parameter to specify elliposid scale. | +---------------------+----------------------------------------------------------+ | **Defined area** | Best for regions predominantly east–west in extent and | | | located in the middle north or south latitudes. | @@ -65,9 +65,7 @@ Parameters .. include:: ../options/y_0.rst -.. include:: ../options/k_0.rst - -.. option:: +scale= +.. option:: +k_0= Ellipsoid Scale factor. Determines a scale factor used in LCC 2SP Michigan variation of the projection. diff --git a/src/PJ_lcc.c b/src/PJ_lcc.c index e3ce3fd3a5..96aa3f2acd 100644 --- a/src/PJ_lcc.c +++ b/src/PJ_lcc.c @@ -5,7 +5,7 @@ #include "proj_math.h" PROJ_HEAD(lcc, "Lambert Conformal Conic") - "\n\tConic, Sph&Ell\n\tlat_1= and lat_2= or lat_0, scale="; + "\n\tConic, Sph&Ell\n\tlat_1= and lat_2= or lat_0, k_0="; #define EPS10 1.e-10 @@ -15,7 +15,6 @@ struct pj_opaque { double n; double rho0; double c; - double scale; }; @@ -32,7 +31,7 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ rho = 0.; } else { rho = Q->c * (P->es != 0. ? - Q->scale * pow(pj_tsfn(lp.phi, sin(lp.phi), P->e), Q->n) : + pow(pj_tsfn(lp.phi, sin(lp.phi), P->e), Q->n) : pow(tan(M_FORTPI + .5 * lp.phi), -Q->n)); } lp.lam *= Q->n; @@ -59,7 +58,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ xy.y = -xy.y; } if (P->es != 0.) { - lp.phi = pj_phi2(P->ctx, pow(rho / (Q->scale * Q->c), 1./Q->n), P->e); + lp.phi = pj_phi2(P->ctx, pow(rho / Q->c, 1./Q->n), P->e); if (lp.phi == HUGE_VAL) { proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); return lp; @@ -85,10 +84,6 @@ PJ *PROJECTION(lcc) { return pj_default_destructor(P, ENOMEM); P->opaque = Q; - Q->scale = 1.; - if (pj_param(P->ctx, P->params, "tscale").i) - Q->scale = pj_param(P->ctx, P->params, "dscale").f; - Q->phi1 = pj_param(P->ctx, P->params, "rlat_1").f; if (pj_param(P->ctx, P->params, "tlat_2").i) Q->phi2 = pj_param(P->ctx, P->params, "rlat_2").f; @@ -115,7 +110,7 @@ PJ *PROJECTION(lcc) { } Q->c = (Q->rho0 = m1 * pow(ml1, -Q->n) / Q->n); Q->rho0 *= (fabs(fabs(P->phi0) - M_HALFPI) < EPS10) ? 0. : - Q->scale * pow(pj_tsfn(P->phi0, sin(P->phi0), P->e), Q->n); + pow(pj_tsfn(P->phi0, sin(P->phi0), P->e), Q->n); } else { if (secant) Q->n = log(cosphi / cos(Q->phi2)) / diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index 2808579ad1..5ccaf33aab 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -2535,9 +2535,9 @@ accept -200 -100 expect -0.001796358 -0.000904233 ------------------------------------------------------------------------------- -Tests with +scale (Lambert Conformal Conic 2SP Michigan). +Tests with +k_0 (Lambert Conformal Conic 2SP Michigan). ------------------------------------------------------------------------------- -operation +proj=lcc +ellps=GRS80 +lat_1=0.5 +lat_2=2 +scale=1.0000382 +operation +proj=lcc +ellps=GRS80 +lat_1=0.5 +lat_2=2 +k_0=1.0000382 ------------------------------------------------------------------------------- tolerance 0.1 mm accept 2 1 @@ -2564,7 +2564,7 @@ expect -0.001796290 -0.000904199 Test various corner cases, spherical projection and one standard parallel to improve test coverage. ------------------------------------------------------------------------------- -operation +proj=lcc +ellps=GRS80 +lat_1=0.5 +lat_2=2 +operation +proj=lcc +ellps=GRS80 +lat_1=0.5 +lat_2=2 ------------------------------------------------------------------------------- tolerance 0.1 mm diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie index 594bcd8176..960e58142a 100644 --- a/test/gie/more_builtins.gie +++ b/test/gie/more_builtins.gie @@ -249,7 +249,7 @@ Tests for LCC 2SP Michigan (from PJ_lcc.c) This test is taken from EPSG guidance note 7-2 (version 54, August 2018, page 25) ------------------------------------------------------------------------------- -operation +proj=lcc +ellps=clrk66 +lat_1=44d11'N +lat_2=45d42'N +x_0=609601.2192 +lon_0=84d20'W +lat_0=43d19'N +scale=1.0000382 +units=us-ft +operation +proj=lcc +ellps=clrk66 +lat_1=44d11'N +lat_2=45d42'N +x_0=609601.2192 +lon_0=84d20'W +lat_0=43d19'N +k_0=1.0000382 +units=us-ft ------------------------------------------------------------------------------- tolerance 5 mm accept 83d10'W 43d45'N