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