|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* PHPCoord. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Doug Wright |
|
6
|
|
|
*/ |
|
7
|
|
|
declare(strict_types=1); |
|
8
|
|
|
|
|
9
|
|
|
namespace PHPCoord\UnitOfMeasure\Length; |
|
10
|
|
|
|
|
11
|
|
|
use PHPCoord\Exception\UnknownUnitOfMeasureException; |
|
12
|
|
|
use PHPCoord\UnitOfMeasure\UnitOfMeasure; |
|
13
|
|
|
|
|
14
|
|
|
abstract class Length implements UnitOfMeasure |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* British chain (Benoit 1895 A) |
|
18
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Clark as 0.9143992 metres per yard. Used for deriving |
|
19
|
|
|
* metric size of ellipsoid in Palestine. |
|
20
|
|
|
*/ |
|
21
|
|
|
public const EPSG_BRITISH_CHAIN_BENOIT_1895_A = 'urn:ogc:def:uom:EPSG::9052'; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* British chain (Benoit 1895 B) |
|
25
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Bomford as 39.370113 inches per metre. Used in West |
|
26
|
|
|
* Malaysian mapping. |
|
27
|
|
|
*/ |
|
28
|
|
|
public const EPSG_BRITISH_CHAIN_BENOIT_1895_B = 'urn:ogc:def:uom:EPSG::9062'; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* British chain (Sears 1922 truncated) |
|
32
|
|
|
* Uses Sear's 1922 British yard-metre ratio (UoM code 9040) truncated to 6 significant figures; this truncated |
|
33
|
|
|
* ratio (0.914398, UoM code 9099) then converted to other imperial units. 1 chSe(T) = 22 ydSe(T). Used in |
|
34
|
|
|
* metrication of Malaya RSO grid. |
|
35
|
|
|
*/ |
|
36
|
|
|
public const EPSG_BRITISH_CHAIN_SEARS_1922_TRUNCATED = 'urn:ogc:def:uom:EPSG::9301'; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* British chain (Sears 1922) |
|
40
|
|
|
* Uses Sear's 1922 British yard-metre ratio as given by Bomford as 39.370147 inches per metre. Used in East |
|
41
|
|
|
* Malaysian and older New Zealand mapping. |
|
42
|
|
|
*/ |
|
43
|
|
|
public const EPSG_BRITISH_CHAIN_SEARS_1922 = 'urn:ogc:def:uom:EPSG::9042'; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* British foot (1865) |
|
47
|
|
|
* Uses Clark's estimate of 1853-1865 British foot-metre ratio of 0.9144025 metres per yard. Used in 1962 and 1975 |
|
48
|
|
|
* estimates of Indian foot. |
|
49
|
|
|
*/ |
|
50
|
|
|
public const EPSG_BRITISH_FOOT_1865 = 'urn:ogc:def:uom:EPSG::9070'; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* British foot (1936) |
|
54
|
|
|
* For the 1936 retriangulation OSGB defines the relationship of 10 feet of 1796 to the International metre through |
|
55
|
|
|
* the logarithmic relationship (10^0.48401603 exactly). 1 ft = 0.3048007491…m. Also used for metric conversions |
|
56
|
|
|
* in Ireland. |
|
57
|
|
|
*/ |
|
58
|
|
|
public const EPSG_BRITISH_FOOT_1936 = 'urn:ogc:def:uom:EPSG::9095'; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* British foot (Benoit 1895 A) |
|
62
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Clark as 0.9143992 metres per yard. Used for deriving |
|
63
|
|
|
* metric size of ellipsoid in Palestine. |
|
64
|
|
|
*/ |
|
65
|
|
|
public const EPSG_BRITISH_FOOT_BENOIT_1895_A = 'urn:ogc:def:uom:EPSG::9051'; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* British foot (Benoit 1895 B) |
|
69
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Bomford as 39.370113 inches per metre. Used in West |
|
70
|
|
|
* Malaysian mapping. |
|
71
|
|
|
*/ |
|
72
|
|
|
public const EPSG_BRITISH_FOOT_BENOIT_1895_B = 'urn:ogc:def:uom:EPSG::9061'; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* British foot (Sears 1922 truncated) |
|
76
|
|
|
* Uses Sear's 1922 British yard-metre ratio (UoM code 9040) truncated to 6 significant figures; this truncated |
|
77
|
|
|
* ratio (0.914398, UoM code 9099) then converted to other imperial units. 3 ftSe(T) = 1 ydSe(T). |
|
78
|
|
|
*/ |
|
79
|
|
|
public const EPSG_BRITISH_FOOT_SEARS_1922_TRUNCATED = 'urn:ogc:def:uom:EPSG::9300'; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* British foot (Sears 1922) |
|
83
|
|
|
* Uses Sear's 1922 British yard-metre ratio as given by Bomford as 39.370147 inches per metre. Used in East |
|
84
|
|
|
* Malaysian and older New Zealand mapping. |
|
85
|
|
|
*/ |
|
86
|
|
|
public const EPSG_BRITISH_FOOT_SEARS_1922 = 'urn:ogc:def:uom:EPSG::9041'; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* British link (Benoit 1895 A) |
|
90
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Clark as 0.9143992 metres per yard. Used for deriving |
|
91
|
|
|
* metric size of ellipsoid in Palestine. |
|
92
|
|
|
*/ |
|
93
|
|
|
public const EPSG_BRITISH_LINK_BENOIT_1895_A = 'urn:ogc:def:uom:EPSG::9053'; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* British link (Benoit 1895 B) |
|
97
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Bomford as 39.370113 inches per metre. Used in West |
|
98
|
|
|
* Malaysian mapping. |
|
99
|
|
|
*/ |
|
100
|
|
|
public const EPSG_BRITISH_LINK_BENOIT_1895_B = 'urn:ogc:def:uom:EPSG::9063'; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* British link (Sears 1922 truncated) |
|
104
|
|
|
* Uses Sear's 1922 British yard-metre ratio (UoM code 9040) truncated to 6 significant figures; this truncated |
|
105
|
|
|
* ratio (0.914398, UoM code 9099) then converted to other imperial units. 100 lkSe(T) = 1 chSe(T). |
|
106
|
|
|
*/ |
|
107
|
|
|
public const EPSG_BRITISH_LINK_SEARS_1922_TRUNCATED = 'urn:ogc:def:uom:EPSG::9302'; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* British link (Sears 1922) |
|
111
|
|
|
* Uses Sear's 1922 British yard-metre ratio as given by Bomford as 39.370147 inches per metre. Used in East |
|
112
|
|
|
* Malaysian and older New Zealand mapping. |
|
113
|
|
|
*/ |
|
114
|
|
|
public const EPSG_BRITISH_LINK_SEARS_1922 = 'urn:ogc:def:uom:EPSG::9043'; |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* British yard (Benoit 1895 A) |
|
118
|
|
|
* Uses Benoit's 1895 British yard-metre ratio as given by Clark as 0.9143992 metres per yard. Used for deriving |
|
119
|
|
|
* metric size of ellipsoid in Palestine. |
|
120
|
|
|
*/ |
|
121
|
|
|
public const EPSG_BRITISH_YARD_BENOIT_1895_A = 'urn:ogc:def:uom:EPSG::9050'; |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* British yard (Benoit 1895 B) |
|
125
|
|
|
* G. Bomford "Geodesy" 2nd edition 1962; after J.S.Clark "Remeasurement of the Old Length Standards"; Empire |
|
126
|
|
|
* Survey Review no. 90; 1953. |
|
127
|
|
|
*/ |
|
128
|
|
|
public const EPSG_BRITISH_YARD_BENOIT_1895_B = 'urn:ogc:def:uom:EPSG::9060'; |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* British yard (Sears 1922 truncated) |
|
132
|
|
|
* Uses Sear's 1922 British yard-metre ratio (UoM code 9040) truncated to 6 significant figures. |
|
133
|
|
|
*/ |
|
134
|
|
|
public const EPSG_BRITISH_YARD_SEARS_1922_TRUNCATED = 'urn:ogc:def:uom:EPSG::9099'; |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* British yard (Sears 1922) |
|
138
|
|
|
* Uses Sear's 1922 British yard-metre ratio as given by Bomford as 39.370147 inches per metre. Used in East |
|
139
|
|
|
* Malaysian and older New Zealand mapping. |
|
140
|
|
|
*/ |
|
141
|
|
|
public const EPSG_BRITISH_YARD_SEARS_1922 = 'urn:ogc:def:uom:EPSG::9040'; |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Clarke's chain |
|
145
|
|
|
* =22 Clarke's yards. Assumes Clarke's 1865 ratio of 1 British foot = 0.3047972654 French legal metres applies to |
|
146
|
|
|
* the international metre. Used in older Australian, southern African & British West Indian mapping. |
|
147
|
|
|
*/ |
|
148
|
|
|
public const EPSG_CLARKES_CHAIN = 'urn:ogc:def:uom:EPSG::9038'; |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Clarke's foot |
|
152
|
|
|
* Assumes Clarke's 1865 ratio of 1 British foot = 0.3047972654 French legal metres applies to the international |
|
153
|
|
|
* metre. Used in older Australian, southern African & British West Indian mapping. |
|
154
|
|
|
*/ |
|
155
|
|
|
public const EPSG_CLARKES_FOOT = 'urn:ogc:def:uom:EPSG::9005'; |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* Clarke's link |
|
159
|
|
|
* =1/100 Clarke's chain. Assumes Clarke's 1865 ratio of 1 British foot = 0.3047972654 French legal metres applies |
|
160
|
|
|
* to the international metre. Used in older Australian, southern African & British West Indian mapping. |
|
161
|
|
|
*/ |
|
162
|
|
|
public const EPSG_CLARKES_LINK = 'urn:ogc:def:uom:EPSG::9039'; |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* Clarke's yard |
|
166
|
|
|
* =3 Clarke's feet. Assumes Clarke's 1865 ratio of 1 British foot = 0.3047972654 French legal metres applies to |
|
167
|
|
|
* the international metre. Used in older Australian, southern African & British West Indian mapping. |
|
168
|
|
|
*/ |
|
169
|
|
|
public const EPSG_CLARKES_YARD = 'urn:ogc:def:uom:EPSG::9037'; |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* German legal metre |
|
173
|
|
|
* Used in Namibia. |
|
174
|
|
|
*/ |
|
175
|
|
|
public const EPSG_GERMAN_LEGAL_METRE = 'urn:ogc:def:uom:EPSG::9031'; |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* Gold Coast foot |
|
179
|
|
|
* Used in Ghana and some adjacent parts of British west Africa prior to metrication, except for the metrication of |
|
180
|
|
|
* projection defining parameters when British foot (Sears 1922) used. |
|
181
|
|
|
*/ |
|
182
|
|
|
public const EPSG_GOLD_COAST_FOOT = 'urn:ogc:def:uom:EPSG::9094'; |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Indian foot |
|
186
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British yard (= 3 British feet) taken to be |
|
187
|
|
|
* J.S.Clark's 1865 value of 0.9144025 metres. |
|
188
|
|
|
*/ |
|
189
|
|
|
public const EPSG_INDIAN_FOOT = 'urn:ogc:def:uom:EPSG::9080'; |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* Indian foot (1937) |
|
193
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British foot taken to be 1895 Benoit value of |
|
194
|
|
|
* 12/39.370113m. Rounded to 8 decimal places as 0.30479841. Used from Bangladesh to Vietnam. Previously used in |
|
195
|
|
|
* India and Pakistan but superseded. |
|
196
|
|
|
*/ |
|
197
|
|
|
public const EPSG_INDIAN_FOOT_1937 = 'urn:ogc:def:uom:EPSG::9081'; |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* Indian foot (1962) |
|
201
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British yard (3 feet) taken to be J.S. Clark's 1865 |
|
202
|
|
|
* value of 0.9144025m. Rounded to 7 significant figures with a small error as 1 Ind ft=0.3047996m. Used in |
|
203
|
|
|
* Pakistan since metrication. |
|
204
|
|
|
*/ |
|
205
|
|
|
public const EPSG_INDIAN_FOOT_1962 = 'urn:ogc:def:uom:EPSG::9082'; |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* Indian foot (1975) |
|
209
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British yard (3 feet) taken to be J.S. Clark's 1865 |
|
210
|
|
|
* value of 0.9144025m. Rounded to 7 significant figures as 1 Ind ft=0.3047995m. Used in India since metrication. |
|
211
|
|
|
*/ |
|
212
|
|
|
public const EPSG_INDIAN_FOOT_1975 = 'urn:ogc:def:uom:EPSG::9083'; |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* Indian yard |
|
216
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British yard (= 3 British feet) taken to be |
|
217
|
|
|
* J.S.Clark's 1865 value of 0.9144025 metres. |
|
218
|
|
|
*/ |
|
219
|
|
|
public const EPSG_INDIAN_YARD = 'urn:ogc:def:uom:EPSG::9084'; |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* Indian yard (1937) |
|
223
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British foot taken to be 1895 Benoit value of |
|
224
|
|
|
* 12/39.370113m. Rounded to 8 decimal places as 0.30479841. Used from Bangladesh to Vietnam. Previously used in |
|
225
|
|
|
* India and Pakistan but superseded. |
|
226
|
|
|
*/ |
|
227
|
|
|
public const EPSG_INDIAN_YARD_1937 = 'urn:ogc:def:uom:EPSG::9085'; |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* Indian yard (1962) |
|
231
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British yard (3 feet) taken to be J.S. Clark's 1865 |
|
232
|
|
|
* value of 0.9144025m. Rounded to 7 significant figures with a small error as 1 Ind ft=0.3047996m. Used in |
|
233
|
|
|
* Pakistan since metrication. |
|
234
|
|
|
*/ |
|
235
|
|
|
public const EPSG_INDIAN_YARD_1962 = 'urn:ogc:def:uom:EPSG::9086'; |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Indian yard (1975) |
|
239
|
|
|
* Indian Foot = 0.99999566 British feet (A.R.Clarke 1865). British yard (3 feet) taken to be J.S. Clark's 1865 |
|
240
|
|
|
* value of 0.9144025m. Rounded to 7 significant figures as 1 Ind ft=0.3047995m. Used in India since metrication. |
|
241
|
|
|
*/ |
|
242
|
|
|
public const EPSG_INDIAN_YARD_1975 = 'urn:ogc:def:uom:EPSG::9087'; |
|
243
|
|
|
|
|
244
|
|
|
/** |
|
245
|
|
|
* Statute mile |
|
246
|
|
|
* =5280 feet. |
|
247
|
|
|
*/ |
|
248
|
|
|
public const EPSG_STATUTE_MILE = 'urn:ogc:def:uom:EPSG::9093'; |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* US survey chain |
|
252
|
|
|
* Used in USA primarily for public lands cadastral work. |
|
253
|
|
|
*/ |
|
254
|
|
|
public const EPSG_US_SURVEY_CHAIN = 'urn:ogc:def:uom:EPSG::9033'; |
|
255
|
|
|
|
|
256
|
|
|
/** |
|
257
|
|
|
* US survey foot |
|
258
|
|
|
* Used in USA. |
|
259
|
|
|
*/ |
|
260
|
|
|
public const EPSG_US_SURVEY_FOOT = 'urn:ogc:def:uom:EPSG::9003'; |
|
261
|
|
|
|
|
262
|
|
|
/** |
|
263
|
|
|
* US survey link |
|
264
|
|
|
* Used in USA primarily for public lands cadastral work. |
|
265
|
|
|
*/ |
|
266
|
|
|
public const EPSG_US_SURVEY_LINK = 'urn:ogc:def:uom:EPSG::9034'; |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* US survey mile |
|
270
|
|
|
* Used in USA primarily for public lands cadastral work. |
|
271
|
|
|
*/ |
|
272
|
|
|
public const EPSG_US_SURVEY_MILE = 'urn:ogc:def:uom:EPSG::9035'; |
|
273
|
|
|
|
|
274
|
|
|
/** |
|
275
|
|
|
* centimetre. |
|
276
|
|
|
*/ |
|
277
|
|
|
public const EPSG_CENTIMETRE = 'urn:ogc:def:uom:EPSG::1033'; |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* chain |
|
281
|
|
|
* =22 international yards or 66 international feet. |
|
282
|
|
|
*/ |
|
283
|
|
|
public const EPSG_CHAIN = 'urn:ogc:def:uom:EPSG::9097'; |
|
284
|
|
|
|
|
285
|
|
|
/** |
|
286
|
|
|
* fathom |
|
287
|
|
|
* = 6 feet. |
|
288
|
|
|
*/ |
|
289
|
|
|
public const EPSG_FATHOM = 'urn:ogc:def:uom:EPSG::9014'; |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* foot. |
|
293
|
|
|
*/ |
|
294
|
|
|
public const EPSG_FOOT = 'urn:ogc:def:uom:EPSG::9002'; |
|
295
|
|
|
|
|
296
|
|
|
/** |
|
297
|
|
|
* kilometre. |
|
298
|
|
|
*/ |
|
299
|
|
|
public const EPSG_KILOMETRE = 'urn:ogc:def:uom:EPSG::9036'; |
|
300
|
|
|
|
|
301
|
|
|
/** |
|
302
|
|
|
* link |
|
303
|
|
|
* =1/100 international chain. |
|
304
|
|
|
*/ |
|
305
|
|
|
public const EPSG_LINK = 'urn:ogc:def:uom:EPSG::9098'; |
|
306
|
|
|
|
|
307
|
|
|
/** |
|
308
|
|
|
* metre |
|
309
|
|
|
* SI base unit for length. |
|
310
|
|
|
*/ |
|
311
|
|
|
public const EPSG_METRE = 'urn:ogc:def:uom:EPSG::9001'; |
|
312
|
|
|
|
|
313
|
|
|
/** |
|
314
|
|
|
* millimetre. |
|
315
|
|
|
*/ |
|
316
|
|
|
public const EPSG_MILLIMETRE = 'urn:ogc:def:uom:EPSG::1025'; |
|
317
|
|
|
|
|
318
|
|
|
/** |
|
319
|
|
|
* nautical mile. |
|
320
|
|
|
*/ |
|
321
|
|
|
public const EPSG_NAUTICAL_MILE = 'urn:ogc:def:uom:EPSG::9030'; |
|
322
|
|
|
|
|
323
|
|
|
/** |
|
324
|
|
|
* yard |
|
325
|
|
|
* =3 international feet. |
|
326
|
|
|
*/ |
|
327
|
|
|
public const EPSG_YARD = 'urn:ogc:def:uom:EPSG::9096'; |
|
328
|
|
|
|
|
329
|
|
|
protected static array $sridData = [ |
|
330
|
|
|
'urn:ogc:def:uom:EPSG::1025' => [ |
|
331
|
|
|
'name' => 'millimetre', |
|
332
|
|
|
], |
|
333
|
|
|
'urn:ogc:def:uom:EPSG::1033' => [ |
|
334
|
|
|
'name' => 'centimetre', |
|
335
|
|
|
], |
|
336
|
|
|
'urn:ogc:def:uom:EPSG::9001' => [ |
|
337
|
|
|
'name' => 'metre', |
|
338
|
|
|
], |
|
339
|
|
|
'urn:ogc:def:uom:EPSG::9002' => [ |
|
340
|
|
|
'name' => 'foot', |
|
341
|
|
|
], |
|
342
|
|
|
'urn:ogc:def:uom:EPSG::9003' => [ |
|
343
|
|
|
'name' => 'US survey foot', |
|
344
|
|
|
], |
|
345
|
|
|
'urn:ogc:def:uom:EPSG::9005' => [ |
|
346
|
|
|
'name' => 'Clarke\'s foot', |
|
347
|
|
|
], |
|
348
|
|
|
'urn:ogc:def:uom:EPSG::9014' => [ |
|
349
|
|
|
'name' => 'fathom', |
|
350
|
|
|
], |
|
351
|
|
|
'urn:ogc:def:uom:EPSG::9030' => [ |
|
352
|
|
|
'name' => 'nautical mile', |
|
353
|
|
|
], |
|
354
|
|
|
'urn:ogc:def:uom:EPSG::9031' => [ |
|
355
|
|
|
'name' => 'German legal metre', |
|
356
|
|
|
], |
|
357
|
|
|
'urn:ogc:def:uom:EPSG::9033' => [ |
|
358
|
|
|
'name' => 'US survey chain', |
|
359
|
|
|
], |
|
360
|
|
|
'urn:ogc:def:uom:EPSG::9034' => [ |
|
361
|
|
|
'name' => 'US survey link', |
|
362
|
|
|
], |
|
363
|
|
|
'urn:ogc:def:uom:EPSG::9035' => [ |
|
364
|
|
|
'name' => 'US survey mile', |
|
365
|
|
|
], |
|
366
|
|
|
'urn:ogc:def:uom:EPSG::9036' => [ |
|
367
|
|
|
'name' => 'kilometre', |
|
368
|
|
|
], |
|
369
|
|
|
'urn:ogc:def:uom:EPSG::9037' => [ |
|
370
|
|
|
'name' => 'Clarke\'s yard', |
|
371
|
|
|
], |
|
372
|
|
|
'urn:ogc:def:uom:EPSG::9038' => [ |
|
373
|
|
|
'name' => 'Clarke\'s chain', |
|
374
|
|
|
], |
|
375
|
|
|
'urn:ogc:def:uom:EPSG::9039' => [ |
|
376
|
|
|
'name' => 'Clarke\'s link', |
|
377
|
|
|
], |
|
378
|
|
|
'urn:ogc:def:uom:EPSG::9040' => [ |
|
379
|
|
|
'name' => 'British yard (Sears 1922)', |
|
380
|
|
|
], |
|
381
|
|
|
'urn:ogc:def:uom:EPSG::9041' => [ |
|
382
|
|
|
'name' => 'British foot (Sears 1922)', |
|
383
|
|
|
], |
|
384
|
|
|
'urn:ogc:def:uom:EPSG::9042' => [ |
|
385
|
|
|
'name' => 'British chain (Sears 1922)', |
|
386
|
|
|
], |
|
387
|
|
|
'urn:ogc:def:uom:EPSG::9043' => [ |
|
388
|
|
|
'name' => 'British link (Sears 1922)', |
|
389
|
|
|
], |
|
390
|
|
|
'urn:ogc:def:uom:EPSG::9050' => [ |
|
391
|
|
|
'name' => 'British yard (Benoit 1895 A)', |
|
392
|
|
|
], |
|
393
|
|
|
'urn:ogc:def:uom:EPSG::9051' => [ |
|
394
|
|
|
'name' => 'British foot (Benoit 1895 A)', |
|
395
|
|
|
], |
|
396
|
|
|
'urn:ogc:def:uom:EPSG::9052' => [ |
|
397
|
|
|
'name' => 'British chain (Benoit 1895 A)', |
|
398
|
|
|
], |
|
399
|
|
|
'urn:ogc:def:uom:EPSG::9053' => [ |
|
400
|
|
|
'name' => 'British link (Benoit 1895 A)', |
|
401
|
|
|
], |
|
402
|
|
|
'urn:ogc:def:uom:EPSG::9060' => [ |
|
403
|
|
|
'name' => 'British yard (Benoit 1895 B)', |
|
404
|
|
|
], |
|
405
|
|
|
'urn:ogc:def:uom:EPSG::9061' => [ |
|
406
|
|
|
'name' => 'British foot (Benoit 1895 B)', |
|
407
|
|
|
], |
|
408
|
|
|
'urn:ogc:def:uom:EPSG::9062' => [ |
|
409
|
|
|
'name' => 'British chain (Benoit 1895 B)', |
|
410
|
|
|
], |
|
411
|
|
|
'urn:ogc:def:uom:EPSG::9063' => [ |
|
412
|
|
|
'name' => 'British link (Benoit 1895 B)', |
|
413
|
|
|
], |
|
414
|
|
|
'urn:ogc:def:uom:EPSG::9070' => [ |
|
415
|
|
|
'name' => 'British foot (1865)', |
|
416
|
|
|
], |
|
417
|
|
|
'urn:ogc:def:uom:EPSG::9080' => [ |
|
418
|
|
|
'name' => 'Indian foot', |
|
419
|
|
|
], |
|
420
|
|
|
'urn:ogc:def:uom:EPSG::9081' => [ |
|
421
|
|
|
'name' => 'Indian foot (1937)', |
|
422
|
|
|
], |
|
423
|
|
|
'urn:ogc:def:uom:EPSG::9082' => [ |
|
424
|
|
|
'name' => 'Indian foot (1962)', |
|
425
|
|
|
], |
|
426
|
|
|
'urn:ogc:def:uom:EPSG::9083' => [ |
|
427
|
|
|
'name' => 'Indian foot (1975)', |
|
428
|
|
|
], |
|
429
|
|
|
'urn:ogc:def:uom:EPSG::9084' => [ |
|
430
|
|
|
'name' => 'Indian yard', |
|
431
|
|
|
], |
|
432
|
|
|
'urn:ogc:def:uom:EPSG::9085' => [ |
|
433
|
|
|
'name' => 'Indian yard (1937)', |
|
434
|
|
|
], |
|
435
|
|
|
'urn:ogc:def:uom:EPSG::9086' => [ |
|
436
|
|
|
'name' => 'Indian yard (1962)', |
|
437
|
|
|
], |
|
438
|
|
|
'urn:ogc:def:uom:EPSG::9087' => [ |
|
439
|
|
|
'name' => 'Indian yard (1975)', |
|
440
|
|
|
], |
|
441
|
|
|
'urn:ogc:def:uom:EPSG::9093' => [ |
|
442
|
|
|
'name' => 'Statute mile', |
|
443
|
|
|
], |
|
444
|
|
|
'urn:ogc:def:uom:EPSG::9094' => [ |
|
445
|
|
|
'name' => 'Gold Coast foot', |
|
446
|
|
|
], |
|
447
|
|
|
'urn:ogc:def:uom:EPSG::9095' => [ |
|
448
|
|
|
'name' => 'British foot (1936)', |
|
449
|
|
|
], |
|
450
|
|
|
'urn:ogc:def:uom:EPSG::9096' => [ |
|
451
|
|
|
'name' => 'yard', |
|
452
|
|
|
], |
|
453
|
|
|
'urn:ogc:def:uom:EPSG::9097' => [ |
|
454
|
|
|
'name' => 'chain', |
|
455
|
|
|
], |
|
456
|
|
|
'urn:ogc:def:uom:EPSG::9098' => [ |
|
457
|
|
|
'name' => 'link', |
|
458
|
|
|
], |
|
459
|
|
|
'urn:ogc:def:uom:EPSG::9099' => [ |
|
460
|
|
|
'name' => 'British yard (Sears 1922 truncated)', |
|
461
|
|
|
], |
|
462
|
|
|
'urn:ogc:def:uom:EPSG::9300' => [ |
|
463
|
|
|
'name' => 'British foot (Sears 1922 truncated)', |
|
464
|
|
|
], |
|
465
|
|
|
'urn:ogc:def:uom:EPSG::9301' => [ |
|
466
|
|
|
'name' => 'British chain (Sears 1922 truncated)', |
|
467
|
|
|
], |
|
468
|
|
|
'urn:ogc:def:uom:EPSG::9302' => [ |
|
469
|
|
|
'name' => 'British link (Sears 1922 truncated)', |
|
470
|
|
|
], |
|
471
|
|
|
]; |
|
472
|
|
|
|
|
473
|
|
|
abstract public function asMetres(): Metre; |
|
474
|
|
|
|
|
475
|
57 |
|
public function add(self $unit): self |
|
476
|
|
|
{ |
|
477
|
57 |
|
$resultAsMetres = new Metre($this->asMetres()->getValue() + $unit->asMetres()->getValue()); |
|
478
|
57 |
|
$conversionRatio = (new static(1))->asMetres()->getValue(); |
|
|
|
|
|
|
479
|
|
|
|
|
480
|
57 |
|
return new static($resultAsMetres->getValue() / $conversionRatio); |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
50 |
|
public function subtract(self $unit): self |
|
484
|
|
|
{ |
|
485
|
50 |
|
$resultAsMetres = new Metre($this->asMetres()->getValue() - $unit->asMetres()->getValue()); |
|
486
|
50 |
|
$conversionRatio = (new static(1))->asMetres()->getValue(); |
|
|
|
|
|
|
487
|
|
|
|
|
488
|
50 |
|
return new static($resultAsMetres->getValue() / $conversionRatio); |
|
489
|
|
|
} |
|
490
|
|
|
|
|
491
|
178 |
|
public function multiply(float $multiplicand): self |
|
492
|
|
|
{ |
|
493
|
178 |
|
return new static($this->getValue() * $multiplicand); |
|
|
|
|
|
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
52 |
|
public function divide(float $divisor): self |
|
497
|
|
|
{ |
|
498
|
52 |
|
return new static($this->getValue() / $divisor); |
|
|
|
|
|
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
299 |
|
public static function makeUnit(float $measurement, string $srid): self |
|
502
|
|
|
{ |
|
503
|
|
|
switch ($srid) { |
|
504
|
299 |
|
case self::EPSG_METRE: |
|
505
|
198 |
|
return new Metre($measurement); |
|
506
|
114 |
|
case self::EPSG_KILOMETRE: |
|
507
|
2 |
|
return new Kilometre($measurement); |
|
508
|
112 |
|
case self::EPSG_CENTIMETRE: |
|
509
|
4 |
|
return new Centimetre($measurement); |
|
510
|
108 |
|
case self::EPSG_MILLIMETRE: |
|
511
|
4 |
|
return new Millimetre($measurement); |
|
512
|
104 |
|
case self::EPSG_NAUTICAL_MILE: |
|
513
|
2 |
|
return new NauticalMile($measurement); |
|
514
|
102 |
|
case self::EPSG_FOOT: |
|
515
|
4 |
|
return new Foot($measurement); |
|
516
|
100 |
|
case self::EPSG_YARD: |
|
517
|
2 |
|
return new Yard($measurement); |
|
518
|
98 |
|
case self::EPSG_CHAIN: |
|
519
|
2 |
|
return new Chain($measurement); |
|
520
|
96 |
|
case self::EPSG_LINK: |
|
521
|
4 |
|
return new Link($measurement); |
|
522
|
92 |
|
case self::EPSG_STATUTE_MILE: |
|
523
|
2 |
|
return new StatuteMile($measurement); |
|
524
|
90 |
|
case self::EPSG_FATHOM: |
|
525
|
2 |
|
return new Fathom($measurement); |
|
526
|
88 |
|
case self::EPSG_BRITISH_FOOT_1865: |
|
527
|
2 |
|
return new BritishFoot1865($measurement); |
|
528
|
86 |
|
case self::EPSG_BRITISH_FOOT_BENOIT_1895_A: |
|
529
|
2 |
|
return new BritishFoot1895BenoitA($measurement); |
|
530
|
84 |
|
case self::EPSG_BRITISH_YARD_BENOIT_1895_A: |
|
531
|
2 |
|
return new BritishYard1895BenoitA($measurement); |
|
532
|
82 |
|
case self::EPSG_BRITISH_CHAIN_BENOIT_1895_A: |
|
533
|
2 |
|
return new BritishChain1895BenoitA($measurement); |
|
534
|
80 |
|
case self::EPSG_BRITISH_LINK_BENOIT_1895_A: |
|
535
|
2 |
|
return new BritishLink1895BenoitA($measurement); |
|
536
|
78 |
|
case self::EPSG_BRITISH_FOOT_BENOIT_1895_B: |
|
537
|
2 |
|
return new BritishFoot1895BenoitB($measurement); |
|
538
|
76 |
|
case self::EPSG_BRITISH_YARD_BENOIT_1895_B: |
|
539
|
2 |
|
return new BritishYard1895BenoitB($measurement); |
|
540
|
74 |
|
case self::EPSG_BRITISH_CHAIN_BENOIT_1895_B: |
|
541
|
2 |
|
return new BritishChain1895BenoitB($measurement); |
|
542
|
72 |
|
case self::EPSG_BRITISH_LINK_BENOIT_1895_B: |
|
543
|
2 |
|
return new BritishLink1895BenoitB($measurement); |
|
544
|
70 |
|
case self::EPSG_BRITISH_FOOT_SEARS_1922: |
|
545
|
2 |
|
return new BritishFoot1922Sears($measurement); |
|
546
|
68 |
|
case self::EPSG_BRITISH_YARD_SEARS_1922: |
|
547
|
2 |
|
return new BritishYard1922Sears($measurement); |
|
548
|
66 |
|
case self::EPSG_BRITISH_CHAIN_SEARS_1922: |
|
549
|
2 |
|
return new BritishChain1922Sears($measurement); |
|
550
|
64 |
|
case self::EPSG_BRITISH_LINK_SEARS_1922: |
|
551
|
2 |
|
return new BritishLink1922Sears($measurement); |
|
552
|
62 |
|
case self::EPSG_BRITISH_FOOT_SEARS_1922_TRUNCATED: |
|
553
|
2 |
|
return new BritishFoot1922SearsTruncated($measurement); |
|
554
|
60 |
|
case self::EPSG_BRITISH_YARD_SEARS_1922_TRUNCATED: |
|
555
|
2 |
|
return new BritishYard1922SearsTruncated($measurement); |
|
556
|
58 |
|
case self::EPSG_BRITISH_CHAIN_SEARS_1922_TRUNCATED: |
|
557
|
2 |
|
return new BritishChain1922SearsTruncated($measurement); |
|
558
|
56 |
|
case self::EPSG_BRITISH_LINK_SEARS_1922_TRUNCATED: |
|
559
|
2 |
|
return new BritishLink1922SearsTruncated($measurement); |
|
560
|
54 |
|
case self::EPSG_BRITISH_FOOT_1936: |
|
561
|
2 |
|
return new BritishFoot1936($measurement); |
|
562
|
52 |
|
case self::EPSG_US_SURVEY_FOOT: |
|
563
|
13 |
|
return new USSurveyFoot($measurement); |
|
564
|
39 |
|
case self::EPSG_US_SURVEY_CHAIN: |
|
565
|
2 |
|
return new USSurveyChain($measurement); |
|
566
|
37 |
|
case self::EPSG_US_SURVEY_LINK: |
|
567
|
2 |
|
return new USSurveyLink($measurement); |
|
568
|
35 |
|
case self::EPSG_US_SURVEY_MILE: |
|
569
|
2 |
|
return new USSurveyMile($measurement); |
|
570
|
33 |
|
case self::EPSG_CLARKES_FOOT: |
|
571
|
6 |
|
return new ClarkeFoot($measurement); |
|
572
|
29 |
|
case self::EPSG_CLARKES_YARD: |
|
573
|
2 |
|
return new ClarkeYard($measurement); |
|
574
|
27 |
|
case self::EPSG_CLARKES_CHAIN: |
|
575
|
2 |
|
return new ClarkeChain($measurement); |
|
576
|
25 |
|
case self::EPSG_CLARKES_LINK: |
|
577
|
4 |
|
return new ClarkeLink($measurement); |
|
578
|
21 |
|
case self::EPSG_INDIAN_FOOT: |
|
579
|
2 |
|
return new IndianFoot($measurement); |
|
580
|
19 |
|
case self::EPSG_INDIAN_YARD: |
|
581
|
2 |
|
return new IndianYard($measurement); |
|
582
|
17 |
|
case self::EPSG_INDIAN_FOOT_1937: |
|
583
|
2 |
|
return new IndianFoot1937($measurement); |
|
584
|
15 |
|
case self::EPSG_INDIAN_YARD_1937: |
|
585
|
2 |
|
return new IndianYard1937($measurement); |
|
586
|
13 |
|
case self::EPSG_INDIAN_FOOT_1962: |
|
587
|
2 |
|
return new IndianFoot1962($measurement); |
|
588
|
11 |
|
case self::EPSG_INDIAN_YARD_1962: |
|
589
|
2 |
|
return new IndianYard1962($measurement); |
|
590
|
9 |
|
case self::EPSG_INDIAN_FOOT_1975: |
|
591
|
2 |
|
return new IndianFoot1975($measurement); |
|
592
|
7 |
|
case self::EPSG_INDIAN_YARD_1975: |
|
593
|
2 |
|
return new IndianYard1975($measurement); |
|
594
|
5 |
|
case self::EPSG_GOLD_COAST_FOOT: |
|
595
|
2 |
|
return new GoldCoastFoot($measurement); |
|
596
|
3 |
|
case self::EPSG_GERMAN_LEGAL_METRE: |
|
597
|
2 |
|
return new GermanLegalMetre($measurement); |
|
598
|
|
|
} |
|
599
|
|
|
|
|
600
|
1 |
|
throw new UnknownUnitOfMeasureException($srid); |
|
601
|
|
|
} |
|
602
|
|
|
|
|
603
|
66 |
|
public static function getSupportedSRIDs(): array |
|
604
|
|
|
{ |
|
605
|
66 |
|
return array_map(function ($sridData) {return $sridData['name']; }, static::$sridData); |
|
606
|
|
|
} |
|
607
|
|
|
|
|
608
|
177 |
|
public static function convert(self $length, string $targetSRID): self |
|
609
|
|
|
{ |
|
610
|
177 |
|
$conversionRatio = static::makeUnit(1, $targetSRID)->asMetres()->getValue(); |
|
611
|
|
|
|
|
612
|
177 |
|
return self::makeUnit($length->asMetres()->getValue() / $conversionRatio, $targetSRID); |
|
613
|
|
|
} |
|
614
|
|
|
|
|
615
|
25 |
|
public function __toString(): string |
|
616
|
|
|
{ |
|
617
|
25 |
|
return (string) $this->getValue(); |
|
618
|
|
|
} |
|
619
|
|
|
} |
|
620
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.