1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* PHPCoord. |
4
|
|
|
* |
5
|
|
|
* @author Doug Wright |
6
|
|
|
*/ |
7
|
|
|
declare(strict_types=1); |
8
|
|
|
|
9
|
|
|
namespace PHPCoord\CoordinateSystem; |
10
|
|
|
|
11
|
|
|
use PHPCoord\Exception\UnknownCoordinateSystemException; |
12
|
|
|
|
13
|
|
|
use function array_map; |
14
|
|
|
|
15
|
|
|
class Vertical extends CoordinateSystem |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* Axis: depth (D). Orientation: down. Units: foot. |
19
|
|
|
* Used in vertical coordinate reference systems. |
20
|
|
|
*/ |
21
|
|
|
public const EPSG_AXIS_DEPTH_D_ORIENTATION_DOWN_UOM_FT = 'urn:ogc:def:cs:EPSG::6495'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Axis: depth (D). Orientation: down. Units: foot (US). |
25
|
|
|
* Used in US vertical coordinate reference systems. |
26
|
|
|
*/ |
27
|
|
|
public const EPSG_AXIS_DEPTH_D_ORIENTATION_DOWN_UOM_FTUS = 'urn:ogc:def:cs:EPSG::1043'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Axis: depth (D). Orientation: down. Units: metre |
31
|
|
|
* Used in vertical coordinate reference systems. |
32
|
|
|
*/ |
33
|
|
|
public const EPSG_AXIS_DEPTH_D_ORIENTATION_DOWN_UOM_M = 'urn:ogc:def:cs:EPSG::6498'; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Axis: height (H). Orientation: up. Units: British foot (1936). |
37
|
|
|
* Used in vertical coordinate reference systems. |
38
|
|
|
*/ |
39
|
|
|
public const EPSG_AXIS_HEIGHT_H_ORIENTATION_UP_UOM_FT_BR36 = 'urn:ogc:def:cs:EPSG::6496'; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Axis: height (H). Orientation: up. Units: foot. |
43
|
|
|
* Used in vertical coordinate reference systems. |
44
|
|
|
*/ |
45
|
|
|
public const EPSG_AXIS_HEIGHT_H_ORIENTATION_UP_UOM_FT = 'urn:ogc:def:cs:EPSG::1030'; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Axis: height (H). Orientation: up. Units: foot (US). |
49
|
|
|
* Used in vertical coordinate reference systems. |
50
|
|
|
*/ |
51
|
|
|
public const EPSG_AXIS_HEIGHT_H_ORIENTATION_UP_UOM_FTUS = 'urn:ogc:def:cs:EPSG::6497'; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Axis: height (H). Orientation: up. Units: metre |
55
|
|
|
* Used in vertical coordinate reference systems. |
56
|
|
|
*/ |
57
|
|
|
public const EPSG_AXIS_HEIGHT_H_ORIENTATION_UP_UOM_M = 'urn:ogc:def:cs:EPSG::6499'; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var array<string, array{name: string, axes: array<array{orientation: string, abbreviation: string, name: string, uom: string}>, help: string}> |
61
|
|
|
*/ |
62
|
|
|
protected static array $sridData = [ |
63
|
|
|
'urn:ogc:def:cs:EPSG::1030' => [ |
64
|
|
|
'name' => 'Axis: height (H). Orientation: up. UoM: ft.', |
65
|
|
|
'axes' => [ |
66
|
|
|
[ |
67
|
|
|
'orientation' => 'up', |
68
|
|
|
'abbreviation' => 'H', |
69
|
|
|
'name' => 'Gravity-related height', |
70
|
|
|
'uom' => 'urn:ogc:def:uom:EPSG::9002', |
71
|
|
|
], |
72
|
|
|
], |
73
|
|
|
'help' => 'Used in vertical coordinate reference systems.', |
74
|
|
|
], |
75
|
|
|
'urn:ogc:def:cs:EPSG::1043' => [ |
76
|
|
|
'name' => 'Axis: depth (D). Orientation: down. UoM: ftUS.', |
77
|
|
|
'axes' => [ |
78
|
|
|
[ |
79
|
|
|
'orientation' => 'down', |
80
|
|
|
'abbreviation' => 'D', |
81
|
|
|
'name' => 'Depth', |
82
|
|
|
'uom' => 'urn:ogc:def:uom:EPSG::9003', |
83
|
|
|
], |
84
|
|
|
], |
85
|
|
|
'help' => 'Used in US vertical coordinate reference systems.', |
86
|
|
|
], |
87
|
|
|
'urn:ogc:def:cs:EPSG::6495' => [ |
88
|
|
|
'name' => 'Axis: depth (D). Orientation: down. UoM: ft.', |
89
|
|
|
'axes' => [ |
90
|
|
|
[ |
91
|
|
|
'orientation' => 'down', |
92
|
|
|
'abbreviation' => 'D', |
93
|
|
|
'name' => 'Depth', |
94
|
|
|
'uom' => 'urn:ogc:def:uom:EPSG::9002', |
95
|
|
|
], |
96
|
|
|
], |
97
|
|
|
'help' => 'Used in vertical coordinate reference systems.', |
98
|
|
|
], |
99
|
|
|
'urn:ogc:def:cs:EPSG::6496' => [ |
100
|
|
|
'name' => 'Axis: height (H). Orientation: up. UoM: ft(Br36).', |
101
|
|
|
'axes' => [ |
102
|
|
|
[ |
103
|
|
|
'orientation' => 'up', |
104
|
|
|
'abbreviation' => 'H', |
105
|
|
|
'name' => 'Gravity-related height', |
106
|
|
|
'uom' => 'urn:ogc:def:uom:EPSG::9095', |
107
|
|
|
], |
108
|
|
|
], |
109
|
|
|
'help' => 'Used in vertical coordinate reference systems.', |
110
|
|
|
], |
111
|
|
|
'urn:ogc:def:cs:EPSG::6497' => [ |
112
|
|
|
'name' => 'Axis: height (H). Orientation: up. UoM: ftUS.', |
113
|
|
|
'axes' => [ |
114
|
|
|
[ |
115
|
|
|
'orientation' => 'up', |
116
|
|
|
'abbreviation' => 'H', |
117
|
|
|
'name' => 'Gravity-related height', |
118
|
|
|
'uom' => 'urn:ogc:def:uom:EPSG::9003', |
119
|
|
|
], |
120
|
|
|
], |
121
|
|
|
'help' => 'Used in vertical coordinate reference systems.', |
122
|
|
|
], |
123
|
|
|
'urn:ogc:def:cs:EPSG::6498' => [ |
124
|
|
|
'name' => 'Axis: depth (D). Orientation: down. UoM: m.', |
125
|
|
|
'axes' => [ |
126
|
|
|
[ |
127
|
|
|
'orientation' => 'down', |
128
|
|
|
'abbreviation' => 'D', |
129
|
|
|
'name' => 'Depth', |
130
|
|
|
'uom' => 'urn:ogc:def:uom:EPSG::9001', |
131
|
|
|
], |
132
|
|
|
], |
133
|
|
|
'help' => 'Used in vertical coordinate reference systems.', |
134
|
|
|
], |
135
|
|
|
'urn:ogc:def:cs:EPSG::6499' => [ |
136
|
|
|
'name' => 'Axis: height (H). Orientation: up. UoM: m.', |
137
|
|
|
'axes' => [ |
138
|
|
|
[ |
139
|
452 |
|
'orientation' => 'up', |
140
|
|
|
'abbreviation' => 'H', |
141
|
452 |
|
'name' => 'Gravity-related height', |
142
|
9 |
|
'uom' => 'urn:ogc:def:uom:EPSG::9001', |
143
|
|
|
], |
144
|
|
|
], |
145
|
443 |
|
'help' => 'Used in vertical coordinate reference systems.', |
146
|
54 |
|
], |
147
|
|
|
]; |
148
|
54 |
|
|
149
|
54 |
|
/** |
150
|
54 |
|
* @var array<string, self> |
151
|
54 |
|
*/ |
152
|
54 |
|
private static array $cachedObjects = []; |
153
|
54 |
|
|
154
|
54 |
|
public static function fromSRID(string $srid): self |
155
|
54 |
|
{ |
156
|
|
|
if (!isset(static::$sridData[$srid])) { |
157
|
|
|
throw new UnknownCoordinateSystemException($srid); |
158
|
54 |
|
} |
159
|
|
|
|
160
|
|
|
if (!isset(self::$cachedObjects[$srid])) { |
161
|
443 |
|
$data = static::$sridData[$srid]; |
162
|
|
|
|
163
|
|
|
$axes = []; |
164
|
9 |
|
foreach ($data['axes'] as $axisData) { |
165
|
|
|
$axes[] = new Axis( |
166
|
9 |
|
$axisData['orientation'], |
167
|
9 |
|
$axisData['abbreviation'], |
168
|
9 |
|
$axisData['name'], |
169
|
|
|
$axisData['uom'], |
170
|
|
|
); |
171
|
9 |
|
} |
172
|
|
|
|
173
|
|
|
self::$cachedObjects[$srid] = new self($srid, $axes); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
return self::$cachedObjects[$srid]; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return array<string, string> |
181
|
|
|
*/ |
182
|
|
|
public static function getSupportedSRIDs(): array |
183
|
|
|
{ |
184
|
|
|
return array_map(fn (array $data) => $data['name'], static::$sridData); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return array<string, array{name: string, help: string}> |
189
|
|
|
*/ |
190
|
|
|
public static function getSupportedSRIDsWithHelp(): array |
191
|
|
|
{ |
192
|
|
|
return array_map(fn (array $data) => ['name' => $data['name'], 'help' => $data['help']], static::$sridData); |
193
|
|
|
} |
194
|
|
|
} |
195
|
|
|
|