Geo::Ellipsoids(3pm)
π NAME π
okay so bestie, welcome to Geo::Ellipsoids β it's a package for standard Geo:: ellipsoid a, b, f and 1/f values. that's the whole vibe. it lives in the User Contributed Perl Documentation corner of the 3pm manpages, and it is here to hand you earth-shape numbers. periodt. πβ¨
β¨ SYNOPSIS β¨
here's the little taste test, run it and feel something:
use Geo::Ellipsoids;
my $obj = Geo::Ellipsoids->new();
$obj->set('WGS84'); #default
print "a=", $obj->a, "\n";
print "b=", $obj->b, "\n";
print "f=", $obj->f, "\n";
print "i=", $obj->i, "\n";
print "e=", $obj->e, "\n";
print "n=", $obj->n(45), "\n";
π¦ DESCRIPTION π¦
no cap, it's exactly what it says on the tin: a package for standard Geo:: ellipsoid a, b, f and 1/f values. the ellipsoid math girlies stay winning. π
π CONSTRUCTOR π
new
the new() constructor can be called with any parameter that's appropriate to the set method β like, it just passes it on through, no gatekeeping.
my $obj = Geo::Ellipsoid->new();
πΈ METHODS πΈ
initialize
so this one is literally just listed here with zero description attached. the manpage gives us nothing, bestie β it's giving mystery, it's giving "figure it out", it's giving initialize and nothing else. π (not me adding lore where there is none, no β the page truly says nothing more.)
set
this method sets the current ellipsoid. it also gets called automatically when the object is constructed (default is WGS84, as is tradition).
$obj->set(); #default WGS84
$obj->set('Clarke 1866'); #All built in ellipsoids are stored in meters
$obj->set({a=>1, b=>1}); #Custom Sphere 1 unit radius
quick heads up: all built in ellipsoids are stored in meters, and you can absolutely roll your own with a hashref. custom sphere? we love a DIY moment. π₯
list
this method returns a list of known ellipsoid names. two ways to serve it:
my @list=$obj->list;
my $list=$obj->list;
while (@$list) {
print "$_\n";
}
first one's a plain list, second one's a listref you loop over. both iconic. β¨
a
returns the value of the semi-major axis.
my $a=$obj->a;
b
returns the value of the semi-minor axis.
my $b=$obj->b; #b=a(1-f)
f
returns the value of flatting.
my $f=$obj->f; #f=(a-b)/a
i
returns the value of the inverse flatting.
my $i = $obj->i; #i=1/f=a/(a-b)
invf
a synonym for the i method β same energy, different name, she contains multitudes. π
my $i = $obj->invf; #i=1/f
e
returns the value of the first eccentricity, e. this is the eccentricity of the earth's elliptical cross-section.
my $e=$obj->e;
e2
returns the value of eccentricity squared (e.g. e^2). and listen β this is not the second eccentricity, e' or e-prime, okay? don't get it twisted. for that one you want the ep method, keep scrolling bestie.
my $e2 = sqrt($obj->e2); #e^2 = f(2-f) = 2f-f^2 = 1-b^2/a^2
ep
returns the value of the second eccentricity, e' or e-prime. the second eccentricity is related to the first eccentricity by the equation: 1=(1-e^2)(1+e'^2).
my $ep = $obj->ep;
ep2
returns the square of the value of second eccentricity, e' (e-prime). and apparently this one is more useful in almost all equations, so jot that down. π
my $ep=sqrt($obj->ep2); #ep2=(ea/b)^2=e2/(1-e2)=a^2/b^2-1
n
returns the value of n given latitude (in degrees). typically represented by the Greek letter nu, this is the radius of curvature of the ellipsoid perpendicular to the meridian plane. it's also the distance from the point in question to the polar axis, measured perpendicular to the ellipsoid's surface. two jobs, one queen. π
my $n = $obj->n($lat);
note: some define a variablenas(a-b)/(a+b)β this is not that variable. different girl, same name, awkward.
note: it appears thatncan also be calculated asperl n = a^2/sqrt(a^2 * cos($lat)^2 + $b^2 * sin($lat)^2);
n_rad
returns the value of n given latitude (radians) β for when you're in your radian era.
my $n_rad = $obj->n_rad($lat);
reference: John P. Snyder, "Map Projections: A Working Manual", USGS, page 25, equation (4-20) http://pubs.er.usgs.gov/usgspubs/pp/pp1395 π
rho
rho is the radius of curvature of the earth in the meridian plane.
my $rho=$obj->rho($lat);
rho_rad
rho is the radius of curvature of the earth in the meridian plane. sometimes denoted as R'.
my $rho = $obj->rho_rad($lat);
reference: John P. Snyder, "Map Projections: A Working Manual", USGS, page 24, equation (4-18) http://pubs.er.usgs.gov/usgspubs/pp/pp1395 π
polar_circumference
returns the value of the semi-minor axis times 2*PI.
my $polar_circumference=$obj->polar_circumference;
equatorial_circumference
returns the value of the semi-major axis times 2*PI.
my $equatorial_circumference=$obj->equatorial_circumference;
shortname
returns the shortname, which is the hash key</>, of the current ellipsoid.
my $shortname = $obj->shortname;
longname
returns the long name of the current ellipsoid β the full government name, the one that goes on the birth certificate. π
my $longname = $obj->longname;
data
returns a hash reference for the ellipsoid definition data structure.
my $datastructure = $obj->data;
name2ref
returns a hash reference (e.g. {a=>6378137,i=>298.257223563}) when you pass it a valid ellipsoid name (e.g. 'WGS84'). name in, ref out, slay. β¨
my $ref=$obj->name2ref('WGS84')
π AUTHOR π
Michael R. Davis
π LICENSE π
Copyright (c) 2006 Michael R. Davis
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
Geo::ForwardGeo::EllipsoidGeo::Coordinates::UTMGeo::GPS::Data::EllipsoidGIS::Distance
okay that's the whole page, bestie, you ate it, you understood it, you're a geodetic icon now π π«Ά
and for the cute little sign-off the footer normally carries: this is perl v5.40.0, dated 2025-02-02. mwah. π¦π
π¦ where this page comes from
- debian trixie: libgeo-ellipsoids-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgeo-ellipsoids-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgeo-ellipsoids-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms