Geo::Functions(3pm)

πŸ“¦
version 0.08 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Geo::Functions πŸ’–

okay so bestie, welcome to Geo::Functions β€” it's a package for standard Geo:: functions, and it's genuinely giving useful little toolkit energy. No cap. This is the Geo::Functions page from the User Contributed Perl Documentation, and we're gonna go through the whole thing together. Grab a strawberry πŸ“, we're doing this.


✨ SYNOPSIS ✨

Two ways to vibe with this, bestie β€” either you import the functions straight into your namespace, or you go full object-oriented main character:

use Geo::Functions qw{deg_rad deg_dms rad_deg}; #import into namespace
print "Degrees: ", deg_rad(3.14/4), "\n";

use Geo::Functions;
my $obj = Geo::Functions->new;
print "Degrees: ", $obj->deg_rad(3.14/2), "\n";

like, look at her. importing exactly the three she needs. we love a girl who knows what she wants πŸ’…


🌸 DESCRIPTION 🌸

Package for standard Geo:: functions.

that's it. that's the whole description. short, sweet, iconic, ate and left no crumbs πŸ‘‘


πŸ¦‹ CONVENTIONS πŸ¦‹

okay this part is SO important and honestly lowkey genius, listen up:

The naming convention is "format of the return" underscore "format of the parameters".

So like, you can read the deg_rad function as "degrees given radians" or "degrees from radians". Return first, input second. Once you clock that pattern, every single function name in here just... makes sense immediately. it's giving cheat code. iykyk ✨


πŸŽ€ CONSTRUCTOR πŸŽ€

new

The new() constructor, bestie. here she is:

my $obj = Geo::Functions->new();

that's your object. your little guy. your baby. go forth 🫢


πŸ’œ METHODS πŸ’œ

initialize

no description in the source for this one, bestie β€” she's just... there. mysterious. main character energy without a backstory πŸ’€

deg_dms

Degrees given degrees minutes seconds. yes, that's a lot of degrees, we know, we're all a little dizzy 😭

my $deg = deg_dms(39, 29, 17.134);
my $deg = deg_dms(39, 29, 17.134, 'N');

you can hand her a hemisphere letter at the end if you're feeling fancy 🌈

deg_rad

Degrees given radians. the classic. the moment. the icon:

my $deg = deg_rad(3.14);

rad_deg

Radians given degrees. it's the reverse, it's the mirror, it's the twin flame situation πŸ’–

my $rad = rad_deg(90);

rad_dms

Radians given degrees minutes seconds:

my $rad = rad_dms(45 30 20.0);

(and yeah bestie, that's exactly how it's written up there β€” commas? not today. we're keeping it exactly as the page says πŸ‘‘)

round

Round to the nearest integer. and this is important, so listen: this formula rounds toward +/- infinity. don't come at me, that's just what she does πŸ’…

my $int = round(42.2);

dms_deg

Degrees minutes seconds given degrees. she hands you back a whole little list β€” $d, $m, $s, and a $sign:

my ($d, $m, $s, $sign) = dms_deg($degrees, qw{N S});
my ($d, $m, $s, $sign) = dms_deg($degrees, qw{E W});

north/south girlies and east/west girlies, she's got you both 🌸

dm_deg

Degrees minutes given degrees. slightly shorter list than her sister above, no seconds here, just vibes:

my ($d, $m, $sign) = dm_deg($degrees, qw{N S});
my ($d, $m, $sign) = dm_deg($degrees, qw{E W});

mps_knots

meters per second given knots:

my $mps = mps_knots(50.0);

knots_mps

knots given meters per second β€” and yes, it's the other direction, it's the remix:

my $knots = knots_mps(25.0);

😭 BUGS 😭

Please log on GitHub.

that's the whole thing. go log it on GitHub bestie, don't suffer in silence πŸ™ˆ


πŸ‘‘ AUTHOR πŸ‘‘

Michael R. Davis


πŸ’€ LICENSE πŸ’€

MIT License

Copyright (c) 2022 Michael R. Davis

MIT! permissive! do your thing! slay! πŸ”₯


🌈 SEE ALSO 🌈

  • Geo::Constants
  • Geo::Ellipsoids

go read those next, bestie, they're in the same universe ⭐


and that's the whole page!! written by perl v5.36.0 and dated 2022-11-21, from the User Contributed Perl Documentation β€” so go make some coordinates, round some integers toward infinity, convert whatever you need to convert, and remember: degrees given radians. return first, parameters second. periodt πŸ’…βœ¨πŸ§šπŸ’œ

πŸ“¦ where this page comes from