|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* PHPCoord |
|
4
|
|
|
* @package PHPCoord |
|
5
|
|
|
* @author Jonathan Stott |
|
6
|
|
|
* @author Doug Wright |
|
7
|
|
|
*/ |
|
8
|
|
|
namespace PHPCoord; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Reference ellipsoid |
|
12
|
|
|
* @author Jonathan Stott |
|
13
|
|
|
* @author Doug Wright |
|
14
|
|
|
* @package PHPCoord |
|
15
|
|
|
*/ |
|
16
|
|
|
class RefEll |
|
17
|
|
|
{ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Major axis |
|
21
|
|
|
* @var float |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $maj; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Minor axis |
|
27
|
|
|
* @var float |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $min; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Eccentricity |
|
33
|
|
|
* @var float |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $ecc; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Create a new RefEll object to represent a reference ellipsoid |
|
39
|
|
|
* |
|
40
|
|
|
* @param float $maj the major axis |
|
41
|
|
|
* @param float $min the minor axis |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct($maj, $min) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->maj = $maj; |
|
46
|
|
|
$this->min = $min; |
|
47
|
|
|
$this->ecc = (($maj * $maj) - ($min * $min)) / ($maj * $maj); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @return float |
|
52
|
|
|
*/ |
|
53
|
|
|
public function getMaj() |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->maj; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @return float |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getMin() |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->min; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return float |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getEcc() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->ecc; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Helper function to create Airy1830 ellipsoid used in GB |
|
77
|
|
|
* @return RefEll |
|
78
|
|
|
*/ |
|
79
|
|
|
public static function airy1830() |
|
80
|
|
|
{ |
|
81
|
|
|
return new RefEll(6377563.396, 6356256.909); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Helper function to create Airy Modified ellipsoid used by Ireland |
|
86
|
|
|
* @return RefEll |
|
87
|
|
|
*/ |
|
88
|
|
|
public static function airyModified() |
|
89
|
|
|
{ |
|
90
|
|
|
return new RefEll(6377340.189, 6356034.447); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Helper function to create WGS84 ellipsoid |
|
95
|
|
|
* @return RefEll |
|
96
|
|
|
*/ |
|
97
|
|
|
public static function wgs84() |
|
98
|
|
|
{ |
|
99
|
|
|
return new RefEll(6378137, 6356752.314245); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Helper function to create GRS80 ellipsoid |
|
104
|
|
|
* @return RefEll |
|
105
|
|
|
*/ |
|
106
|
|
|
public static function grs80() |
|
107
|
|
|
{ |
|
108
|
|
|
return new RefEll(6378137, 6356752.314140); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Helper function to create Clarke1866 ellipsoid |
|
113
|
|
|
* @return RefEll |
|
114
|
|
|
*/ |
|
115
|
|
|
public static function clarke1866() |
|
116
|
|
|
{ |
|
117
|
|
|
return new RefEll(6378206.4, 6356583.8); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Helper function to create International 1924 (Heyford) ellipsoid |
|
122
|
|
|
* @return RefEll |
|
123
|
|
|
*/ |
|
124
|
|
|
public static function international1924() |
|
125
|
|
|
{ |
|
126
|
|
|
return new RefEll(6378388.0, 6356911.9); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Helper function to create International 1924 (Heyford) ellipsoid |
|
131
|
|
|
* @return RefEll |
|
132
|
|
|
*/ |
|
133
|
|
|
public static function heyford1924() |
|
134
|
|
|
{ |
|
135
|
|
|
return new RefEll(6378388.0, 6356911.9); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* Helper function to create Bessel 1841 ellipsoid |
|
140
|
|
|
* @return RefEll |
|
141
|
|
|
*/ |
|
142
|
|
|
public static function bessel1841() |
|
143
|
|
|
{ |
|
144
|
|
|
return new RefEll(6377397.155, 6356078.963); |
|
145
|
|
|
} |
|
146
|
|
|
} |
|
147
|
|
|
|