1Geo::Ellipsoids(3) User Contributed Perl Documentation Geo::Ellipsoids(3)
2
3
4
6 Geo::Ellipsoids - Package for standard Geo:: ellipsoid a, b, f and 1/f
7 values.
8
10 use Geo::Ellipsoids;
11 my $obj = Geo::Ellipsoids->new();
12 $obj->set('WGS84'); #default
13 print "a=", $obj->a, "\n";
14 print "b=", $obj->b, "\n";
15 print "f=", $obj->f, "\n";
16 print "i=", $obj->i, "\n";
17 print "e=", $obj->e, "\n";
18 print "n=", $obj->n(45), "\n";
19
22 new
23
24 The new() constructor may be called with any parameter that is appro‐
25 priate to the set method.
26
27 my $obj = Geo::Ellipsoid->new();
28
30 set
31
32 Method sets the current ellipsoid. This method is called when the
33 object is constructed (default is WGS84).
34
35 $obj->set(); #default WGS84
36 $obj->set('Clarke 1866'); #All built in ellipsoids are stored in meters
37 $obj->set({a=>1, b=>1}); #Custom Sphere 1 unit radius
38
39 list
40
41 Method returns a list of known elipsoid names.
42
43 my @list=$obj->list;
44
45 my $list=$obj->list;
46 while (@$list) {
47 print "$_\n";
48 }
49
50 a
51
52 Method returns the value of the semi-major axis.
53
54 my $a=$obj->a;
55
56 b
57
58 Method returns the value of the semi-minor axis.
59
60 my $b=$obj->b; #b=a(1-f)
61
62 f
63
64 Method returns the value of flatting
65
66 my $f=$obj->f; #f=(a-b)/a
67
68 i
69
70 Method returns the value of the inverse flatting
71
72 my $i=$obj->i; #i=1/f=a/(a-b)
73
74 invf
75
76 Method synonym for the i method
77
78 my $i=$obj->invf; #i=1/f
79
80 e
81
82 Method returns the value of the first eccentricity, e. This is the
83 eccentricity of the earth's elliptical cross-section.
84
85 my $e=$obj->e;
86
87 e2
88
89 Method returns the value of eccentricity squared (e.g. e^2). This is
90 not the second eccentricity, e' or e-prime see the "ep" method.
91
92 my $e=sqrt($obj->e2); #e^2 = f(2-f) = 2f-f^2 = 1-b^2/a^2
93
94 ep
95
96 Method returns the value of the second eccentricity, e' or e-prime.
97 The second eccentricity is related to the first eccentricity by the
98 equation: 1=(1-e^2)(1+e'^2).
99
100 my $ep=$obj->ep;
101
102 ep2
103
104 Method returns the square of value of second eccentricity, e'
105 (e-prime). This is more useful in almost all equations.
106
107 my $ep=sqrt($obj->ep2); #ep2=(ea/b)^2=e2/(1-e2)=a^2/b^2-1
108
109 n
110
111 Method returns the value of n given latitude (degrees). Typically rep‐
112 resented by the Greek letter nu, this is the radius of curvature of the
113 ellipsoid perpendicular to the meridian plane. It is also the distance
114 from the point in question to the polar axis, measured perpendicular to
115 the ellipsoid's surface.
116
117 my $n=$obj->n($lat);
118
119 Note: Some define a variable n as (a-b)/(a+b) this is not that vari‐
120 able.
121
122 n_rad
123
124 Method returns the value of n given latitude (radians).
125
126 my $n=$obj->n_rad($lat);
127
128 rho
129
130 rho is the radius of curvature of the earth in the meridian plane.
131
132 my $rho=$obj->rho($lat);
133
134 rho_rad
135
136 rho is the radius of curvature of the earth in the meridian plane.
137
138 my $rho=$obj->rho_rad($lat);
139
140 polar_circumference
141
142 Method returns the value of the semi-minor axis times 2*PI.
143
144 my $polar_circumference=$obj->polar_circumference;
145
146 equatorial_circumference
147
148 Method returns the value of the semi-major axis times 2*PI.
149
150 my $equatorial_circumference=$obj->equatorial_circumference;
151
152 shortname
153
154 Method returns the shortname, which is the hash key, of the current
155 ellipsoid
156
157 my $shortname=$obj->shortname;
158
159 longname
160
161 Method returns the long name of the current ellipsoid
162
163 my $longname=$obj->longname;
164
165 data
166
167 Method returns a hash reference for the ellipsoid definition data
168 structure.
169
170 my $datastructure=$obj->data;
171
172 name2ref
173
174 Method returns a hash reference (e.g. {a=>6378137,i=>298.257223563})
175 when passed a valid ellipsoid name (e.g. 'WGS84').
176
177 my $ref=$obj->name2ref('WGS84')
178
180 What should we do about bad input? I tend to die in the module which
181 for most situations is fine. I guess you could always overload die to
182 handle exceptions for web based solutions and the like.
183
184 Support for ellipsoid aliases in the data structure
185
187 Please send to the geo-perl email list.
188
190 No guarantees that Perl handles all of the double precision calcula‐
191 tions in the same manner as Fortran.
192
194 Michael R. Davis qw/perl michaelrdavis com/
195
197 Copyright (c) 2006 Michael R. Davis (mrdvt92)
198
199 This library is free software; you can redistribute it and/or modify it
200 under the same terms as Perl itself.
201
203 Geo::Forward Geo::Ellipsoid Geo::Coordinates::UTM
204 Geo::GPS::Data::Ellipsoid GIS::Distance
205
206
207
208perl v5.8.8 2007-02-07 Geo::Ellipsoids(3)