Passed
Push — master ( 8bd5c3...1e8670 )
by Doug
62:22
created

Ellipsoid::getSupportedSRIDsWithHelp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord\Datum;
10
11
use PHPCoord\Exception\UnknownEllipsoidException;
12
use PHPCoord\UnitOfMeasure\Length\Length;
13
14
use function sqrt;
15
use function array_map;
16
17
class Ellipsoid
18
{
19
    /**
20
     * Airy 1830
21
     * Original definition is a=20923713, b=20853810 feet of 1796. 1/f is given to 7 decimal places. For the 1936
22
     * retriangulation OSGB defines the relationship of 10 feet of 1796 to the International metre through
23
     * ([10^0.48401603]/10) exactly = 0.3048007491...
24
     */
25
    public const EPSG_AIRY_1830 = 'urn:ogc:def:ellipsoid:EPSG::7001';
26
27
    /**
28
     * Airy Modified 1849
29
     * OSGB Airy 1830 figure (ellipsoid code 7001) rescaled by 0.999965 to best fit the scale of the 19th century
30
     * primary triangulation of Ireland.
31
     */
32
    public const EPSG_AIRY_MODIFIED_1849 = 'urn:ogc:def:ellipsoid:EPSG::7002';
33
34
    /**
35
     * Australian National Spheroid
36
     * Based on the GRS 1967 figure but with 1/f taken to 2 decimal places exactly.  The dimensions are also used as
37
     * the GRS 1967 Modified ellipsoid (see code 7050).
38
     */
39
    public const EPSG_AUSTRALIAN_NATIONAL_SPHEROID = 'urn:ogc:def:ellipsoid:EPSG::7003';
40
41
    /**
42
     * Average Terrestrial System 1977.
43
     */
44
    public const EPSG_AVERAGE_TERRESTRIAL_SYSTEM_1977 = 'urn:ogc:def:ellipsoid:EPSG::7041';
45
46
    /**
47
     * Bessel 1841
48
     * Original Bessel definition is a=3272077.14 and b=3261139.33 toise. This used a weighted mean of values from
49
     * several authors but did not account for differences in the length of the various toise: the "Bessel toise" is
50
     * therefore of uncertain length.
51
     */
52
    public const EPSG_BESSEL_1841 = 'urn:ogc:def:ellipsoid:EPSG::7004';
53
54
    /**
55
     * Bessel Modified
56
     * Used in Norway and also in Sweden with a 1mm increase in semi-major axis.
57
     */
58
    public const EPSG_BESSEL_MODIFIED = 'urn:ogc:def:ellipsoid:EPSG::7005';
59
60
    /**
61
     * Bessel Namibia (GLM)
62
     * The semi-major axis has the same value as the Bessel 1841 ellipsoid (code 7004) but is in different units -
63
     * German Legal Metres rather than International metres - hence a different size.  a = 6377483.865 International
64
     * metres. Used in Namibia.
65
     */
66
    public const EPSG_BESSEL_NAMIBIA_GLM = 'urn:ogc:def:ellipsoid:EPSG::7046';
67
68
    /**
69
     * CGCS2000
70
     * Defining parameters semi-major axis, flattening and angular velocity are same as for GRS 1980 (ellipsoid code
71
     * 7019); GM = 3986004.4e8 m*m*m/s/s (from NASA 1986 Lageos determination).
72
     */
73
    public const EPSG_CGCS2000 = 'urn:ogc:def:ellipsoid:EPSG::1024';
74
75
    /**
76
     * Clarke 1858
77
     * Clarke's 1858/II solution. Derived parameters: a = 6378293.645m using his 1865 ratio of 0.3047972654 feet per
78
     * metre; 1/f = 294.26068…  In Australia and Amoco Trinidad 1/f taken to two decimal places (294.26 exactly);
79
     * elsewhere a and b used to derive 1/f.
80
     */
81
    public const EPSG_CLARKE_1858 = 'urn:ogc:def:ellipsoid:EPSG::7007';
82
83
    /**
84
     * Clarke 1866
85
     * Original definition a=20926062 and b=20855121 (British) feet. Uses Clarke's 1865 inch-metre ratio of 39.370432
86
     * to obtain metres. (Metric value then converted to US survey feet for use in the US and international feet for
87
     * use in Cayman Islands).
88
     */
89
    public const EPSG_CLARKE_1866 = 'urn:ogc:def:ellipsoid:EPSG::7008';
90
91
    /**
92
     * Clarke 1866 Authalic Sphere
93
     * Authalic sphere derived from Clarke 1866 ellipsoid (code 7008).
94
     */
95
    public const EPSG_CLARKE_1866_AUTHALIC_SPHERE = 'urn:ogc:def:ellipsoid:EPSG::7052';
96
97
    /**
98
     * Clarke 1880
99
     * Clarke gave a and b and also 1/f=293.465 (to 3 decimal places exactly). In the 19th century b was normally given
100
     * as the second defining parameter.
101
     */
102
    public const EPSG_CLARKE_1880 = 'urn:ogc:def:ellipsoid:EPSG::7034';
103
104
    /**
105
     * Clarke 1880 (Arc)
106
     * Adopts Clarke's value for a with derived 1/f.  Uses his 1865 ratio of 39.370432 inch per metre to convert
107
     * semi-major axis to metres.
108
     */
109
    public const EPSG_CLARKE_1880_ARC = 'urn:ogc:def:ellipsoid:EPSG::7013';
110
111
    /**
112
     * Clarke 1880 (Benoit)
113
     * Adopts Clarke's values for a and b.  Uses Benoit's 1895 ratio of 0.9143992 metres per yard to convert to metres.
114
     */
115
    public const EPSG_CLARKE_1880_BENOIT = 'urn:ogc:def:ellipsoid:EPSG::7010';
116
117
    /**
118
     * Clarke 1880 (IGN)
119
     * Adopts Clarke's values for a and b using his 1865 ratio of 39.370432 inches per metre to convert axes to metres.
120
     */
121
    public const EPSG_CLARKE_1880_IGN = 'urn:ogc:def:ellipsoid:EPSG::7011';
122
123
    /**
124
     * Clarke 1880 (RGS)
125
     * Adopts Clarke's values for a and 1/f.  Adopts his 1865 ratio of 39.370432 inches per metre to convert semi-major
126
     * axis to metres. Also known as Clarke Modified 1880.
127
     */
128
    public const EPSG_CLARKE_1880_RGS = 'urn:ogc:def:ellipsoid:EPSG::7012';
129
130
    /**
131
     * Clarke 1880 (SGA 1922)
132
     * Used in Old French Triangulation (ATF).   Uses Clarke's 1865 inch-metre ratio of 39.370432 to convert axes to
133
     * metres.
134
     */
135
    public const EPSG_CLARKE_1880_SGA_1922 = 'urn:ogc:def:ellipsoid:EPSG::7014';
136
137
    /**
138
     * Clarke 1880 (international foot)
139
     * Clarke's 1880 definition in feet assumed for the purposes of metric conversion to be international foot. a =
140
     * 6378306.370…metres. 1/f derived from a and b = 293.4663077… Used in Fiji.
141
     */
142
    public const EPSG_CLARKE_1880_INTERNATIONAL_FOOT = 'urn:ogc:def:ellipsoid:EPSG::7055';
143
144
    /**
145
     * Danish 1876
146
     * Semi-major axis originally given as 3271883.25 toise. Uses toise to French metre ratio of 1.94903631 to two
147
     * decimal place precision. An alternative ratio with the German legal metre of 1.9490622 giving 6377104m has not
148
     * been used in Danish work.
149
     */
150
    public const EPSG_DANISH_1876 = 'urn:ogc:def:ellipsoid:EPSG::7051';
151
152
    /**
153
     * Everest (1830 Definition)
154
     * Everest gave a and b to 2 decimal places and also 1/f=300.8017 (to 4 decimal places exactly). In the 19th
155
     * century b was normally given as the second defining parameter.
156
     */
157
    public const EPSG_EVEREST_1830_DEFINITION = 'urn:ogc:def:ellipsoid:EPSG::7042';
158
159
    /**
160
     * Everest 1830 (1937 Adjustment)
161
     * Used for the 1937 readjustment of Indian triangulation.  Clarke's 1865 Indian-British foot ratio (0.99999566)
162
     * and Benoit's 1898 British inch-metre ratio (39.370113) rounded as 0.30479841 exactly and applied to Everest's
163
     * 1830 definition taken as a and 1/f.
164
     */
165
    public const EPSG_EVEREST_1830_1937_ADJUSTMENT = 'urn:ogc:def:ellipsoid:EPSG::7015';
166
167
    /**
168
     * Everest 1830 (1962 Definition)
169
     * Used by Pakistan since metrication.  Clarke's 1865 Indian foot-British foot ratio (0.99999566) and his 1865
170
     * British inch-metre ratio (39.369971) rounded with slight error as 1 Ind ft = 0.3047995m exactly and applied to
171
     * Everest's 1830 definition of a & b.
172
     */
173
    public const EPSG_EVEREST_1830_1962_DEFINITION = 'urn:ogc:def:ellipsoid:EPSG::7044';
174
175
    /**
176
     * Everest 1830 (1967 Definition)
177
     * Adopted 1967 for use in East Malaysia.  Applies Sears 1922 inch-metre ratio of 39.370147 to Everest 1830
178
     * original definition of a and 1/f but with a taken to be in British rather than Indian feet.
179
     */
180
    public const EPSG_EVEREST_1830_1967_DEFINITION = 'urn:ogc:def:ellipsoid:EPSG::7016';
181
182
    /**
183
     * Everest 1830 (1975 Definition)
184
     * Used by India since metrication.  Clarke's 1865 Indian foot-British foot ratio (0.99999566) and his 1865 British
185
     * inch-metre ratio (39.369971) rounded as 1 Ind ft = 0.3047995m exactly applied to Everest's 1830 original
186
     * definition taken as a and b.
187
     */
188
    public const EPSG_EVEREST_1830_1975_DEFINITION = 'urn:ogc:def:ellipsoid:EPSG::7045';
189
190
    /**
191
     * Everest 1830 (RSO 1969)
192
     * Adopted for 1969 metrication of peninsula Malaysia RSO grid.  Uses Sears 1922 yard-metre ratio truncated to 6
193
     * significant figures applied to Everest 1830 original definition of a and 1/f but with a taken to be in British
194
     * rather than Indian feet.
195
     */
196
    public const EPSG_EVEREST_1830_RSO_1969 = 'urn:ogc:def:ellipsoid:EPSG::7056';
197
198
    /**
199
     * Everest 1830 Modified
200
     * Adopted 1967 for use in West Malaysia.  Applies Benoit 1898 inch-metre ratio of 39.370113 to Everest 1830
201
     * original definition of a and 1/f but with a taken to be in British rather than Indian feet.
202
     */
203
    public const EPSG_EVEREST_1830_MODIFIED = 'urn:ogc:def:ellipsoid:EPSG::7018';
204
205
    /**
206
     * GEM 10C
207
     * Used for  GEM 10C Gravity Potential Model.
208
     */
209
    public const EPSG_GEM_10C = 'urn:ogc:def:ellipsoid:EPSG::7031';
210
211
    /**
212
     * GRS 1967
213
     * Adopted by IUGG 1967 Lucerne.  1/f given is derived from geocentric gravitational constant (GM)= 398603e9
214
     * m*m*m/s/s; dynamic form factor (J2) = 0.0010827 and Earth's angular velocity w = 7.2921151467e-5 rad/s. See also
215
     * GRS 1967 Modified (code 7050).
216
     */
217
    public const EPSG_GRS_1967 = 'urn:ogc:def:ellipsoid:EPSG::7036';
218
219
    /**
220
     * GRS 1967 Modified
221
     * Based on the GRS 1967 figure (code 7036) but with 1/f taken to 2 decimal places exactly. Used with SAD69 and
222
     * TWD67 datums. The dimensions are also used as the Australian National Spheroid (code 7003).
223
     */
224
    public const EPSG_GRS_1967_MODIFIED = 'urn:ogc:def:ellipsoid:EPSG::7050';
225
226
    /**
227
     * GRS 1980
228
     * Adopted by IUGG 1979 Canberra.  Inverse flattening is derived from geocentric gravitational constant GM =
229
     * 3986005e8 m*m*m/s/s; dynamic form factor J2 = 108263e-8 and Earth's angular velocity = 7292115e-11 rad/s.
230
     */
231
    public const EPSG_GRS_1980 = 'urn:ogc:def:ellipsoid:EPSG::7019';
232
233
    /**
234
     * GRS 1980 Authalic Sphere
235
     * Authalic sphere derived from GRS 1980 ellipsoid (code 7019).  (An authalic sphere is one with a surface area
236
     * equal to the surface area of the ellipsoid). 1/f is infinite.
237
     */
238
    public const EPSG_GRS_1980_AUTHALIC_SPHERE = 'urn:ogc:def:ellipsoid:EPSG::7048';
239
240
    /**
241
     * GSK-2011.
242
     */
243
    public const EPSG_GSK_2011 = 'urn:ogc:def:ellipsoid:EPSG::1025';
244
245
    /**
246
     * Helmert 1906
247
     * Helmert 1906/III solution.
248
     */
249
    public const EPSG_HELMERT_1906 = 'urn:ogc:def:ellipsoid:EPSG::7020';
250
251
    /**
252
     * Hough 1960.
253
     */
254
    public const EPSG_HOUGH_1960 = 'urn:ogc:def:ellipsoid:EPSG::7053';
255
256
    /**
257
     * Hughes 1980
258
     * Used in US DMSP SSM/I microwave sensor processing software. Semi-minor axis derived from
259
     * eccentricity=0.081816153. Semi-major axis (a) sometimes given as 3443.992nm which OGP suspects is a derived
260
     * approximation. OGP conversion assumes 1nm=1852m exactly.
261
     */
262
    public const EPSG_HUGHES_1980 = 'urn:ogc:def:ellipsoid:EPSG::7058';
263
264
    /**
265
     * IAG 1975.
266
     */
267
    public const EPSG_IAG_1975 = 'urn:ogc:def:ellipsoid:EPSG::7049';
268
269
    /**
270
     * Indonesian National Spheroid
271
     * Based on the GRS 1967 figure but with 1/f taken to 3 decimal places exactly.
272
     */
273
    public const EPSG_INDONESIAN_NATIONAL_SPHEROID = 'urn:ogc:def:ellipsoid:EPSG::7021';
274
275
    /**
276
     * International 1924
277
     * Adopted by IUGG 1924 in Madrid. Based on Hayford 1909/1910 figures.
278
     */
279
    public const EPSG_INTERNATIONAL_1924 = 'urn:ogc:def:ellipsoid:EPSG::7022';
280
281
    /**
282
     * International 1924 Authalic Sphere
283
     * Authalic sphere derived from International 1924 ellipsoid (code 7022).
284
     */
285
    public const EPSG_INTERNATIONAL_1924_AUTHALIC_SPHERE = 'urn:ogc:def:ellipsoid:EPSG::7057';
286
287
    /**
288
     * Krassowsky 1940.
289
     */
290
    public const EPSG_KRASSOWSKY_1940 = 'urn:ogc:def:ellipsoid:EPSG::7024';
291
292
    /**
293
     * NWL 9D
294
     * Used by Transit Precise Ephemeris between October 1971 and January 1987.
295
     */
296
    public const EPSG_NWL_9D = 'urn:ogc:def:ellipsoid:EPSG::7025';
297
298
    /**
299
     * OSU86F
300
     * Used for OSU86 gravity potential (geoidal) model.
301
     */
302
    public const EPSG_OSU86F = 'urn:ogc:def:ellipsoid:EPSG::7032';
303
304
    /**
305
     * OSU91A
306
     * Used for OSU91 gravity potential (geoidal) model.
307
     */
308
    public const EPSG_OSU91A = 'urn:ogc:def:ellipsoid:EPSG::7033';
309
310
    /**
311
     * PZ-90
312
     * Earth's angular velocity ω = 7.292115e-5 rad/sec; gravitational constant GM =  3986004.418e8 m*m*m/s/s.
313
     */
314
    public const EPSG_PZ_90 = 'urn:ogc:def:ellipsoid:EPSG::7054';
315
316
    /**
317
     * Plessis 1817
318
     * Rescaling of Delambre 1810 figure (a=6376985 m) to make meridional arc from equator to pole equal to 10000000
319
     * metres exactly. (Ref: Strasser).
320
     */
321
    public const EPSG_PLESSIS_1817 = 'urn:ogc:def:ellipsoid:EPSG::7027';
322
323
    /**
324
     * Struve 1860
325
     * Original definition of semi-major axis given as 3272539 toise.  In "Ellipsoidisch Parameter der Erdfigur
326
     * (1800-1950)" , Strasser suggests a conversion factor of 1.94903631 which gives a=6378297.337 metres.
327
     */
328
    public const EPSG_STRUVE_1860 = 'urn:ogc:def:ellipsoid:EPSG::7028';
329
330
    /**
331
     * WGS 72.
332
     */
333
    public const EPSG_WGS_72 = 'urn:ogc:def:ellipsoid:EPSG::7043';
334
335
    /**
336
     * WGS 84
337
     * 1/f derived from four defining parameters semi-major axis; C20 = -484.16685*10e-6; earth's angular velocity ω =
338
     * 7292115e-11 rad/sec; gravitational constant GM = 3986005e8 m*m*m/s/s. In 1994 new GM = 3986004.418e8 m*m*m/s/s
339
     * but a and 1/f retained.
340
     */
341
    public const EPSG_WGS_84 = 'urn:ogc:def:ellipsoid:EPSG::7030';
342
343
    /**
344
     * War Office
345
     * In non-metric form, a=20926201 Gold Coast feet. DMA Technical Manual 8358.1 and data derived from this quotes
346
     * value for semi-major axis as 6378300.58m: OGP recommends use of defined value 6378300m exactly.
347
     */
348
    public const EPSG_WAR_OFFICE = 'urn:ogc:def:ellipsoid:EPSG::7029';
349
350
    /**
351
     * Zach 1812
352
     * Defined as log a = 6.5266022 Klafter (Austrian fathom, Kl), log b = 6.5251990 Kl. a=10^6.526 6022 = 3362035 Kl.
353
     * Then using the Austro-Hungarian 1871 KL/m legal ratio of 1.89648384, a = 6376045m.
354
     */
355
    public const EPSG_ZACH_1812 = 'urn:ogc:def:ellipsoid:EPSG::1026';
356
357
    /**
358
     * @var array<string, array{name: string, semi_major_axis: float|Length, semi_minor_axis: float|Length, uom: string, help: string}>
359
     */
360
    protected static array $sridData = [
361
        'urn:ogc:def:ellipsoid:EPSG::1024' => [
362
            'name' => 'CGCS2000',
363
            'semi_major_axis' => 6378137.0,
364
            'semi_minor_axis' => 6356752.314140356,
365
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
366
            'help' => 'Defining parameters semi-major axis, flattening and angular velocity are same as for GRS 1980 (ellipsoid code 7019); GM = 3986004.4e8 m*m*m/s/s (from NASA 1986 Lageos determination).',
367
        ],
368
        'urn:ogc:def:ellipsoid:EPSG::1025' => [
369
            'name' => 'GSK-2011',
370
            'semi_major_axis' => 6378136.5,
371
            'semi_minor_axis' => 6356751.757955603,
372
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
373
            'help' => '',
374
        ],
375
        'urn:ogc:def:ellipsoid:EPSG::1026' => [
376
            'name' => 'Zach 1812',
377
            'semi_major_axis' => 6376045.0,
378
            'semi_minor_axis' => 6355477.112903226,
379
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
380
            'help' => 'Defined as log a = 6.5266022 Klafter (Austrian fathom, Kl), log b = 6.5251990 Kl. a=10^6.526 6022 = 3362035 Kl. Then using the Austro-Hungarian 1871 KL/m legal ratio of 1.89648384, a = 6376045m',
381
        ],
382
        'urn:ogc:def:ellipsoid:EPSG::7001' => [
383
            'name' => 'Airy 1830',
384
            'semi_major_axis' => 6377563.396,
385
            'semi_minor_axis' => 6356256.909237285,
386
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
387
            'help' => 'Original definition is a=20923713, b=20853810 feet of 1796. 1/f is given to 7 decimal places. For the 1936 retriangulation OSGB defines the relationship of 10 feet of 1796 to the International metre through ([10^0.48401603]/10) exactly = 0.3048007491...',
388
        ],
389
        'urn:ogc:def:ellipsoid:EPSG::7002' => [
390
            'name' => 'Airy Modified 1849',
391
            'semi_major_axis' => 6377340.189,
392
            'semi_minor_axis' => 6356034.447938534,
393
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
394
            'help' => 'OSGB Airy 1830 figure (ellipsoid code 7001) rescaled by 0.999965 to best fit the scale of the 19th century primary triangulation of Ireland.',
395
        ],
396
        'urn:ogc:def:ellipsoid:EPSG::7003' => [
397
            'name' => 'Australian National Spheroid',
398
            'semi_major_axis' => 6378160.0,
399
            'semi_minor_axis' => 6356774.719195306,
400
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
401
            'help' => 'Based on the GRS 1967 figure but with 1/f taken to 2 decimal places exactly.  The dimensions are also used as the GRS 1967 Modified ellipsoid (see code 7050).',
402
        ],
403
        'urn:ogc:def:ellipsoid:EPSG::7004' => [
404
            'name' => 'Bessel 1841',
405
            'semi_major_axis' => 6377397.155,
406
            'semi_minor_axis' => 6356078.962818189,
407
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
408
            'help' => 'Original Bessel definition is a=3272077.14 and b=3261139.33 toise. This used a weighted mean of values from several authors but did not account for differences in the length of the various toise: the "Bessel toise" is therefore of uncertain length.',
409
        ],
410
        'urn:ogc:def:ellipsoid:EPSG::7005' => [
411
            'name' => 'Bessel Modified',
412
            'semi_major_axis' => 6377492.018,
413
            'semi_minor_axis' => 6356173.508712696,
414
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
415
            'help' => 'Used in Norway and also in Sweden with a 1mm increase in semi-major axis.',
416
        ],
417
        'urn:ogc:def:ellipsoid:EPSG::7007' => [
418
            'name' => 'Clarke 1858',
419
            'semi_major_axis' => 20926348.0,
420
            'semi_minor_axis' => 20855233.0,
421
            'uom' => 'urn:ogc:def:uom:EPSG::9005',
422
            'help' => 'Clarke\'s 1858/II solution. Derived parameters: a = 6378293.645m using his 1865 ratio of 0.3047972654 feet per metre; 1/f = 294.26068…  In Australia and Amoco Trinidad 1/f taken to two decimal places (294.26 exactly); elsewhere a and b used to derive 1/f.',
423
        ],
424
        'urn:ogc:def:ellipsoid:EPSG::7008' => [
425
            'name' => 'Clarke 1866',
426
            'semi_major_axis' => 6378206.4,
427
            'semi_minor_axis' => 6356583.8,
428
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
429
            'help' => 'Original definition a=20926062 and b=20855121 (British) feet. Uses Clarke\'s 1865 inch-metre ratio of 39.370432 to obtain metres. (Metric value then converted to US survey feet for use in the US and international feet for use in Cayman Islands).',
430
        ],
431
        'urn:ogc:def:ellipsoid:EPSG::7010' => [
432
            'name' => 'Clarke 1880 (Benoit)',
433
            'semi_major_axis' => 6378300.789,
434
            'semi_minor_axis' => 6356566.435,
435
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
436
            'help' => 'Adopts Clarke\'s values for a and b.  Uses Benoit\'s 1895 ratio of 0.9143992 metres per yard to convert to metres.',
437
        ],
438
        'urn:ogc:def:ellipsoid:EPSG::7011' => [
439
            'name' => 'Clarke 1880 (IGN)',
440
            'semi_major_axis' => 6378249.2,
441
            'semi_minor_axis' => 6356515.0,
442
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
443
            'help' => 'Adopts Clarke\'s values for a and b using his 1865 ratio of 39.370432 inches per metre to convert axes to metres.',
444
        ],
445
        'urn:ogc:def:ellipsoid:EPSG::7012' => [
446
            'name' => 'Clarke 1880 (RGS)',
447
            'semi_major_axis' => 6378249.145,
448
            'semi_minor_axis' => 6356514.8695497755,
449
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
450
            'help' => 'Adopts Clarke\'s values for a and 1/f.  Adopts his 1865 ratio of 39.370432 inches per metre to convert semi-major axis to metres. Also known as Clarke Modified 1880.',
451
        ],
452
        'urn:ogc:def:ellipsoid:EPSG::7013' => [
453
            'name' => 'Clarke 1880 (Arc)',
454
            'semi_major_axis' => 6378249.145,
455
            'semi_minor_axis' => 6356514.966398753,
456
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
457
            'help' => 'Adopts Clarke\'s value for a with derived 1/f.  Uses his 1865 ratio of 39.370432 inch per metre to convert semi-major axis to metres.',
458
        ],
459
        'urn:ogc:def:ellipsoid:EPSG::7014' => [
460
            'name' => 'Clarke 1880 (SGA 1922)',
461
            'semi_major_axis' => 6378249.2,
462
            'semi_minor_axis' => 6356514.996941779,
463
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
464
            'help' => 'Used in Old French Triangulation (ATF).   Uses Clarke\'s 1865 inch-metre ratio of 39.370432 to convert axes to metres.',
465
        ],
466
        'urn:ogc:def:ellipsoid:EPSG::7015' => [
467
            'name' => 'Everest 1830 (1937 Adjustment)',
468
            'semi_major_axis' => 6377276.345,
469
            'semi_minor_axis' => 6356075.413140239,
470
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
471
            'help' => 'Used for the 1937 readjustment of Indian triangulation.  Clarke\'s 1865 Indian-British foot ratio (0.99999566) and Benoit\'s 1898 British inch-metre ratio (39.370113) rounded as 0.30479841 exactly and applied to Everest\'s 1830 definition taken as a and 1/f',
472
        ],
473
        'urn:ogc:def:ellipsoid:EPSG::7016' => [
474
            'name' => 'Everest 1830 (1967 Definition)',
475
            'semi_major_axis' => 6377298.556,
476
            'semi_minor_axis' => 6356097.550300896,
477
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
478
            'help' => 'Adopted 1967 for use in East Malaysia.  Applies Sears 1922 inch-metre ratio of 39.370147 to Everest 1830 original definition of a and 1/f but with a taken to be in British rather than Indian feet.',
479
        ],
480
        'urn:ogc:def:ellipsoid:EPSG::7018' => [
481
            'name' => 'Everest 1830 Modified',
482
            'semi_major_axis' => 6377304.063,
483
            'semi_minor_axis' => 6356103.038993155,
484
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
485
            'help' => 'Adopted 1967 for use in West Malaysia.  Applies Benoit 1898 inch-metre ratio of 39.370113 to Everest 1830 original definition of a and 1/f but with a taken to be in British rather than Indian feet.',
486
        ],
487
        'urn:ogc:def:ellipsoid:EPSG::7019' => [
488
            'name' => 'GRS 1980',
489
            'semi_major_axis' => 6378137.0,
490
            'semi_minor_axis' => 6356752.314140356,
491
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
492
            'help' => 'Adopted by IUGG 1979 Canberra.  Inverse flattening is derived from geocentric gravitational constant GM = 3986005e8 m*m*m/s/s; dynamic form factor J2 = 108263e-8 and Earth\'s angular velocity = 7292115e-11 rad/s.',
493
        ],
494
        'urn:ogc:def:ellipsoid:EPSG::7020' => [
495
            'name' => 'Helmert 1906',
496
            'semi_major_axis' => 6378200.0,
497
            'semi_minor_axis' => 6356818.169627891,
498
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
499
            'help' => 'Helmert 1906/III solution.',
500
        ],
501
        'urn:ogc:def:ellipsoid:EPSG::7021' => [
502
            'name' => 'Indonesian National Spheroid',
503
            'semi_major_axis' => 6378160.0,
504
            'semi_minor_axis' => 6356774.50408554,
505
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
506
            'help' => 'Based on the GRS 1967 figure but with 1/f taken to 3 decimal places exactly.',
507
        ],
508
        'urn:ogc:def:ellipsoid:EPSG::7022' => [
509
            'name' => 'International 1924',
510
            'semi_major_axis' => 6378388.0,
511
            'semi_minor_axis' => 6356911.9461279465,
512
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
513
            'help' => 'Adopted by IUGG 1924 in Madrid. Based on Hayford 1909/1910 figures. ',
514
        ],
515
        'urn:ogc:def:ellipsoid:EPSG::7024' => [
516
            'name' => 'Krassowsky 1940',
517
            'semi_major_axis' => 6378245.0,
518
            'semi_minor_axis' => 6356863.018773047,
519
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
520
            'help' => '',
521
        ],
522
        'urn:ogc:def:ellipsoid:EPSG::7025' => [
523
            'name' => 'NWL 9D',
524
            'semi_major_axis' => 6378145.0,
525
            'semi_minor_axis' => 6356759.769488684,
526
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
527
            'help' => 'Used by Transit Precise Ephemeris between October 1971 and January 1987.',
528
        ],
529
        'urn:ogc:def:ellipsoid:EPSG::7027' => [
530
            'name' => 'Plessis 1817',
531
            'semi_major_axis' => 6376523.0,
532
            'semi_minor_axis' => 6355862.933255573,
533
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
534
            'help' => 'Rescaling of Delambre 1810 figure (a=6376985 m) to make meridional arc from equator to pole equal to 10000000 metres exactly. (Ref: Strasser).',
535
        ],
536
        'urn:ogc:def:ellipsoid:EPSG::7028' => [
537
            'name' => 'Struve 1860',
538
            'semi_major_axis' => 6378298.3,
539
            'semi_minor_axis' => 6356657.142669562,
540
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
541
            'help' => 'Original definition of semi-major axis given as 3272539 toise.  In "Ellipsoidisch Parameter der Erdfigur (1800-1950)" , Strasser suggests a conversion factor of 1.94903631 which gives a=6378297.337 metres.',
542
        ],
543
        'urn:ogc:def:ellipsoid:EPSG::7029' => [
544
            'name' => 'War Office',
545
            'semi_major_axis' => 6378300.0,
546
            'semi_minor_axis' => 6356751.689189189,
547
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
548
            'help' => 'In non-metric form, a=20926201 Gold Coast feet. DMA Technical Manual 8358.1 and data derived from this quotes value for semi-major axis as 6378300.58m: OGP recommends use of defined value 6378300m exactly.',
549
        ],
550
        'urn:ogc:def:ellipsoid:EPSG::7030' => [
551
            'name' => 'WGS 84',
552
            'semi_major_axis' => 6378137.0,
553
            'semi_minor_axis' => 6356752.314245179,
554
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
555
            'help' => '1/f derived from four defining parameters semi-major axis; C20 = -484.16685*10e-6; earth\'s angular velocity ω = 7292115e-11 rad/sec; gravitational constant GM = 3986005e8 m*m*m/s/s. In 1994 new GM = 3986004.418e8 m*m*m/s/s but a and 1/f retained.',
556
        ],
557
        'urn:ogc:def:ellipsoid:EPSG::7031' => [
558
            'name' => 'GEM 10C',
559
            'semi_major_axis' => 6378137.0,
560
            'semi_minor_axis' => 6356752.314245179,
561
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
562
            'help' => 'Used for  GEM 10C Gravity Potential Model.',
563
        ],
564
        'urn:ogc:def:ellipsoid:EPSG::7032' => [
565
            'name' => 'OSU86F',
566
            'semi_major_axis' => 6378136.2,
567
            'semi_minor_axis' => 6356751.516927429,
568
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
569
            'help' => 'Used for OSU86 gravity potential (geoidal) model.',
570
        ],
571
        'urn:ogc:def:ellipsoid:EPSG::7033' => [
572
            'name' => 'OSU91A',
573
            'semi_major_axis' => 6378136.3,
574
            'semi_minor_axis' => 6356751.616592146,
575
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
576
            'help' => 'Used for OSU91 gravity potential (geoidal) model.',
577
        ],
578
        'urn:ogc:def:ellipsoid:EPSG::7034' => [
579
            'name' => 'Clarke 1880',
580
            'semi_major_axis' => 20926202.0,
581
            'semi_minor_axis' => 20854895.0,
582
            'uom' => 'urn:ogc:def:uom:EPSG::9005',
583
            'help' => 'Clarke gave a and b and also 1/f=293.465 (to 3 decimal places exactly). In the 19th century b was normally given as the second defining parameter.',
584
        ],
585
        'urn:ogc:def:ellipsoid:EPSG::7036' => [
586
            'name' => 'GRS 1967',
587
            'semi_major_axis' => 6378160.0,
588
            'semi_minor_axis' => 6356774.516090714,
589
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
590
            'help' => 'Adopted by IUGG 1967 Lucerne.  1/f given is derived from geocentric gravitational constant (GM)= 398603e9 m*m*m/s/s; dynamic form factor (J2) = 0.0010827 and Earth\'s angular velocity w = 7.2921151467e-5 rad/s. See also GRS 1967 Modified (code 7050).',
591
        ],
592
        'urn:ogc:def:ellipsoid:EPSG::7041' => [
593
            'name' => 'Average Terrestrial System 1977',
594
            'semi_major_axis' => 6378135.0,
595
            'semi_minor_axis' => 6356750.304921594,
596
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
597
            'help' => '',
598
        ],
599
        'urn:ogc:def:ellipsoid:EPSG::7042' => [
600
            'name' => 'Everest (1830 Definition)',
601
            'semi_major_axis' => 20922931.8,
602
            'semi_minor_axis' => 20853374.58,
603
            'uom' => 'urn:ogc:def:uom:EPSG::9080',
604
            'help' => 'Everest gave a and b to 2 decimal places and also 1/f=300.8017 (to 4 decimal places exactly). In the 19th century b was normally given as the second defining parameter.',
605
        ],
606
        'urn:ogc:def:ellipsoid:EPSG::7043' => [
607
            'name' => 'WGS 72',
608
            'semi_major_axis' => 6378135.0,
609
            'semi_minor_axis' => 6356750.520016094,
610
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
611
            'help' => '',
612
        ],
613
        'urn:ogc:def:ellipsoid:EPSG::7044' => [
614
            'name' => 'Everest 1830 (1962 Definition)',
615
            'semi_major_axis' => 6377301.243,
616
            'semi_minor_axis' => 6356100.230165385,
617
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
618
            'help' => 'Used by Pakistan since metrication.  Clarke\'s 1865 Indian foot-British foot ratio (0.99999566) and his 1865 British inch-metre ratio (39.369971) rounded with slight error as 1 Ind ft = 0.3047995m exactly and applied to Everest\'s 1830 definition of a & b.',
619
        ],
620
        'urn:ogc:def:ellipsoid:EPSG::7045' => [
621
            'name' => 'Everest 1830 (1975 Definition)',
622
            'semi_major_axis' => 6377299.151,
623
            'semi_minor_axis' => 6356098.145120132,
624
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
625
            'help' => 'Used by India since metrication.  Clarke\'s 1865 Indian foot-British foot ratio (0.99999566) and his 1865 British inch-metre ratio (39.369971) rounded as 1 Ind ft = 0.3047995m exactly applied to Everest\'s 1830 original definition taken as a and b.',
626
        ],
627
        'urn:ogc:def:ellipsoid:EPSG::7046' => [
628
            'name' => 'Bessel Namibia (GLM)',
629
            'semi_major_axis' => 6377397.155,
630
            'semi_minor_axis' => 6356078.962818189,
631
            'uom' => 'urn:ogc:def:uom:EPSG::9031',
632
            'help' => 'The semi-major axis has the same value as the Bessel 1841 ellipsoid (code 7004) but is in different units - German Legal Metres rather than International metres - hence a different size.  a = 6377483.865 International metres. Used in Namibia.',
633
        ],
634
        'urn:ogc:def:ellipsoid:EPSG::7048' => [
635
            'name' => 'GRS 1980 Authalic Sphere',
636
            'semi_major_axis' => 6371007.0,
637
            'semi_minor_axis' => 6371007.0,
638
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
639
            'help' => 'Authalic sphere derived from GRS 1980 ellipsoid (code 7019).  (An authalic sphere is one with a surface area equal to the surface area of the ellipsoid). 1/f is infinite.',
640
        ],
641
        'urn:ogc:def:ellipsoid:EPSG::7049' => [
642
            'name' => 'IAG 1975',
643
            'semi_major_axis' => 6378140.0,
644
            'semi_minor_axis' => 6356755.288157528,
645
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
646
            'help' => '',
647
        ],
648
        'urn:ogc:def:ellipsoid:EPSG::7050' => [
649
            'name' => 'GRS 1967 Modified',
650
            'semi_major_axis' => 6378160.0,
651
            'semi_minor_axis' => 6356774.719195306,
652
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
653
            'help' => 'Based on the GRS 1967 figure (code 7036) but with 1/f taken to 2 decimal places exactly. Used with SAD69 and TWD67 datums. The dimensions are also used as the Australian National Spheroid (code 7003).',
654
        ],
655
        'urn:ogc:def:ellipsoid:EPSG::7051' => [
656
            'name' => 'Danish 1876',
657
            'semi_major_axis' => 6377019.27,
658
            'semi_minor_axis' => 6355762.5391,
659
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
660
            'help' => 'Semi-major axis originally given as 3271883.25 toise. Uses toise to French metre ratio of 1.94903631 to two decimal place precision. An alternative ratio with the German legal metre of 1.9490622 giving 6377104m has not been used in Danish work.',
661
        ],
662
        'urn:ogc:def:ellipsoid:EPSG::7052' => [
663
            'name' => 'Clarke 1866 Authalic Sphere',
664
            'semi_major_axis' => 6370997.0,
665
            'semi_minor_axis' => 6370997.0,
666
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
667
            'help' => 'Authalic sphere derived from Clarke 1866 ellipsoid (code 7008).',
668
        ],
669 558
        'urn:ogc:def:ellipsoid:EPSG::7053' => [
670
            'name' => 'Hough 1960',
671 558
            'semi_major_axis' => 6378270.0,
672 558
            'semi_minor_axis' => 6356794.343434343,
673 558
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
674 558
            'help' => '',
675
        ],
676
        'urn:ogc:def:ellipsoid:EPSG::7054' => [
677 6991
            'name' => 'PZ-90',
678
            'semi_major_axis' => 6378136.0,
679 6991
            'semi_minor_axis' => 6356751.361745712,
680
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
681
            'help' => 'Earth\'s angular velocity ω = 7.292115e-5 rad/sec; gravitational constant GM =  3986004.418e8 m*m*m/s/s.',
682 297
        ],
683
        'urn:ogc:def:ellipsoid:EPSG::7055' => [
684 297
            'name' => 'Clarke 1880 (international foot)',
685
            'semi_major_axis' => 20926202.0,
686
            'semi_minor_axis' => 20854895.0,
687 6793
            'uom' => 'urn:ogc:def:uom:EPSG::9002',
688
            'help' => 'Clarke\'s 1880 definition in feet assumed for the purposes of metric conversion to be international foot. a = 6378306.370…metres. 1/f derived from a and b = 293.4663077… Used in Fiji.',
689 6793
        ],
690
        'urn:ogc:def:ellipsoid:EPSG::7056' => [
691
            'name' => 'Everest 1830 (RSO 1969)',
692 324
            'semi_major_axis' => 6377295.664,
693
            'semi_minor_axis' => 6356094.667915204,
694 324
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
695
            'help' => 'Adopted for 1969 metrication of peninsula Malaysia RSO grid.  Uses Sears 1922 yard-metre ratio truncated to 6 significant figures applied to Everest 1830 original definition of a and 1/f but with a taken to be in British rather than Indian feet.',
696
        ],
697 4601
        'urn:ogc:def:ellipsoid:EPSG::7057' => [
698
            'name' => 'International 1924 Authalic Sphere',
699 4601
            'semi_major_axis' => 6371228.0,
700
            'semi_minor_axis' => 6371228.0,
701
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
702 6343
            'help' => 'Authalic sphere derived from International 1924 ellipsoid (code 7022).',
703
        ],
704 6343
        'urn:ogc:def:ellipsoid:EPSG::7058' => [
705
            'name' => 'Hughes 1980',
706
            'semi_major_axis' => 6378273.0,
707 3582
            'semi_minor_axis' => 6356889.449,
708
            'uom' => 'urn:ogc:def:uom:EPSG::9001',
709 3582
            'help' => 'Used in US DMSP SSM/I microwave sensor processing software. Semi-minor axis derived from eccentricity=0.081816153. Semi-major axis (a) sometimes given as 3443.992nm which OGP suspects is a derived approximation. OGP conversion assumes 1nm=1852m exactly.',
710
        ],
711
    ];
712
713
    /**
714
     * @var array<string, self>
715
     */
716
    private static array $cachedObjects = [];
717 4004
718
    protected Length $semiMajorAxis;
719 4004
720 9
    protected Length $semiMinorAxis;
721
722
    protected string $name;
723 3995
724 540
    protected string $srid;
725
726 540
    public function __construct(Length $semiMajorAxis, Length $semiMinorAxis, string $name = '', string $srid = '')
727 540
    {
728
        $this->semiMajorAxis = $semiMajorAxis;
729 540
        $this->semiMinorAxis = $semiMinorAxis;
730 540
        $this->name = $name;
731 540
        $this->srid = $srid;
732 540
    }
733 540
734 540
    public function getSemiMajorAxis(): Length
735
    {
736
        return $this->semiMajorAxis;
737 3995
    }
738
739
    public function getSemiMinorAxis(): Length
740 288
    {
741
        return $this->semiMinorAxis;
742 288
    }
743 288
744 288
    public function getFlattening(): float
745
    {
746
        return ($this->semiMajorAxis->getValue() - $this->semiMinorAxis->getValue()) / $this->semiMajorAxis->getValue();
747 288
    }
748
749
    public function getInverseFlattening(): float
750 99
    {
751
        return 1 / $this->getFlattening();
752 99
    }
753
754
    public function getEccentricity(): float
755
    {
756
        return sqrt($this->getEccentricitySquared());
757
    }
758
759
    public function getEccentricitySquared(): float
760
    {
761
        return (2 * $this->getFlattening()) - $this->getFlattening() ** 2;
762
    }
763
764
    public function getName(): string
765
    {
766
        return $this->name;
767
    }
768
769
    public function getSRID(): string
770
    {
771
        return $this->srid;
772
    }
773
774
    public static function fromSRID(string $srid): self
775
    {
776
        if (!isset(static::$sridData[$srid])) {
777
            throw new UnknownEllipsoidException($srid);
778
        }
779
780
        if (!isset(self::$cachedObjects[$srid])) {
781
            $data = static::$sridData[$srid];
782
783
            $semiMajorAxis = $data['semi_major_axis'] instanceof Length ? $data['semi_major_axis'] : Length::makeUnit($data['semi_major_axis'], $data['uom']);
784
            $semiMinorAxis = $data['semi_minor_axis'] instanceof Length ? $data['semi_minor_axis'] : Length::makeUnit($data['semi_minor_axis'], $data['uom']);
785
786
            self::$cachedObjects[$srid] = new self(
787
                $semiMajorAxis,
788
                $semiMinorAxis,
789
                $data['name'],
790
                $srid,
791
            );
792
        }
793
794
        return self::$cachedObjects[$srid];
795
    }
796
797
    /**
798
     * @return array<string, string>
799
     */
800
    public static function getSupportedSRIDs(): array
801
    {
802
        return array_map(fn (array $data) => $data['name'], static::$sridData);
803
    }
804
805
    /**
806
     * @return array<string, array{name: string, help: string}>
807
     */
808
    public static function getSupportedSRIDsWithHelp(): array
809
    {
810
        return array_map(fn (array $data) => ['name' => $data['name'], 'help' => $data['help']], static::$sridData);
811
    }
812
813
    public static function registerCustomEllipsoid(string $srid, string $name, Length $semiMajorAxis, Length $semiMinorAxis, string $help = ''): void
814
    {
815
        self::$sridData[$srid] = ['name' => $name, 'semi_major_axis' => $semiMajorAxis, 'semi_minor_axis' => $semiMinorAxis, 'uom' => '', 'help' => $help];
816
    }
817
}
818