Skip to content

Commit d069819

Browse files
committed
Add +R_C as an ellipsoid spherification parameter to use the radius of the conformal sphere
1 parent 91748f8 commit d069819

File tree

3 files changed

+54
-11
lines changed

3 files changed

+54
-11
lines changed

docs/source/usage/ellipsoids.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,29 @@ the ellipsoid into a sphere with features defined by the ellipsoid.
6565
Ellipsoid spherification parameters
6666
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6767

68-
.. option:: +R_A=<value>
68+
.. option:: +R_A
6969

7070
A sphere with the same surface area as the ellipsoid.
7171

72-
.. option:: +R_V=<value>
72+
.. option:: +R_V
7373

7474
A sphere with the same volume as the ellipsoid.
7575

76-
.. option:: +R_a=<value>
76+
.. option:: +R_C
77+
78+
.. versionadded:: 9.3.0
79+
80+
A sphere whose radius is the radius of the conformal sphere at :math:`\phi_0`.
81+
82+
.. option:: +R_a
7783

7884
A sphere with :math:`R = (a + b)/2` (arithmetic mean).
7985

80-
.. option:: +R_g=<value>
86+
.. option:: +R_g
8187

8288
A sphere with :math:`R = \sqrt{ab}` (geometric mean).
8389

84-
.. option:: +R_h=<value>
90+
.. option:: +R_h
8591

8692
A sphere with :math:`R = 2ab/(a+b)` (harmonic mean).
8793

src/ell_set.cpp

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,21 @@ int pj_ellipsoid(PJ *P) {
4949
5050
Spherification parameters supported are:
5151
R_A, which gives a sphere with the same surface area as the
52-
ellipsoid R_V, which gives a sphere with the same volume as the ellipsoid
52+
ellipsoid R_V, which gives a sphere with the same volume as the
53+
ellipsoid
5354
5455
R_a, which gives a sphere with R = (a + b)/2 (arithmetic mean)
5556
R_g, which gives a sphere with R = sqrt(a*b) (geometric mean)
5657
R_h, which gives a sphere with R = 2*a*b/(a+b) (harmonic mean)
5758
5859
R_lat_a=phi, which gives a sphere with R being the arithmetic mean
59-
of of the corresponding ellipsoid at latitude phi. R_lat_g=phi, which gives
60-
a sphere with R being the geometric mean of of the corresponding ellipsoid
61-
at latitude phi.
60+
of of the corresponding ellipsoid at latitude phi.
61+
R_lat_g=phi, which gives
62+
a sphere with R being the geometric mean of of the corresponding
63+
ellipsoid at latitude phi.
64+
65+
R_C, which gives a sphere with the radius of the conformal sphere
66+
at phi0.
6267
6368
If R is given as size parameter, any shape and spherification parameters
6469
given are ignored.
@@ -349,8 +354,8 @@ static const double RV6 = 55 / 1296.;
349354
/***************************************************************************************/
350355
static int ellps_spherification(PJ *P) {
351356
/***************************************************************************************/
352-
const char *keys[] = {"R_A", "R_V", "R_a", "R_g",
353-
"R_h", "R_lat_a", "R_lat_g"};
357+
const char *keys[] = {"R_A", "R_V", "R_a", "R_g",
358+
"R_h", "R_lat_a", "R_lat_g", "R_C"};
354359
size_t len, i;
355360
paralist *par = nullptr;
356361

@@ -428,6 +433,22 @@ static int ellps_spherification(PJ *P) {
428433
else /* geometric */
429434
P->a *= sqrt(1 - P->es) / t;
430435
break;
436+
437+
/* R_C - a sphere with R = radius of conformal sphere, taken at a
438+
* latitude that is phi0 (note: at least for mercator. for other
439+
* projection methods, this could be phi1)
440+
* Formula from IOGP Publication 373-7-2 – Geomatics Guidance Note number 7,
441+
* part 2 1.1 Ellipsoid parameters
442+
*/
443+
case 7:
444+
t = sin(P->phi0);
445+
t = 1 - P->es * t * t;
446+
if (t == 0.) {
447+
proj_log_error(P, _("Invalid eccentricity"));
448+
return proj_errno_set(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE);
449+
}
450+
P->a *= sqrt(1 - P->es) / t;
451+
break;
431452
}
432453

433454
if (P->a <= 0.) {

test/gie/builtins.gie

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,6 +3749,22 @@ direction inverse
37493749
accept 0 1e-15
37503750
expect 0 57.295779513e-15
37513751

3752+
-------------------------------------------------------------------------------
3753+
# Mercator Spherical
3754+
operation +proj=merc +R_C +ellps=WGS84 +lat_0=45
3755+
-------------------------------------------------------------------------------
3756+
accept 2 49
3757+
expect 221892.515234695253 6253822.971804938279
3758+
3759+
-------------------------------------------------------------------------------
3760+
# Mercator Spherical
3761+
operation +proj=merc +R_C +a=6371007 +b=6371007
3762+
-------------------------------------------------------------------------------
3763+
# Test point from IOGP guidance note 7.2
3764+
tolerance 1cm
3765+
accept -100.33333333333333 24.381786944444446
3766+
expect -11156569.90 2796869.94
3767+
37523768

37533769
===============================================================================
37543770
# Miller Oblated Stereographic

0 commit comments

Comments
 (0)