Geo::Forward(3)

πŸ“¦
version 0.16 Β· 2 versions
, in fedora 43

πŸ’– Geo::Forward πŸ’–

okay bestie, so this is Geo::Forward(3) β€” a User Contributed Perl Documentation page, and it's literally the little module that does the "if I walk this far in this direction from here, where do I end up?" math. ✨


✨ NAME ✨

Geo::Forward β€” Calculate geographic location from latitude, longitude, distance, and heading. 🧭


🌸 SYNOPSIS 🌸

here's the whole vibe in one go, no cap:

use Geo::Forward;
my $gf                         = Geo::Forward->new(); # default "WGS84"
my ($lat1, $lon1, $faz, $dist) = (38.871022, -77.055874, 62.888507083, 4565.6854);
my ($lat2, $lon2, $baz)        = $gf->forward($lat1, $lon1, $faz, $dist);
print "Input Lat: $lat1  Lon: $lon1\n";
print "Input Forward Azimuth: $faz (degrees)\n";
print "Input Distance: $dist (meters)\n";
print "Output Lat: $lat2 Lon: $lon2\n";
print "Output Back Azimuth: $baz (degreees)\n";
note: degreees in that last print is not a typo I introduced β€” that's how it is in the original. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

So this module is a pure Perl port of the NGS program in the public domain called forward, which was written by Robert (Sid) Safford and Stephen J. Frakes. iconic lineage honestly. πŸ’…


πŸŽ€ CONSTRUCTOR πŸŽ€

new

The new() constructor may be called with any parameter that is appropriate to the ellipsoid method which establishes the ellipsoid. ✨

my $gf = Geo::Forward->new(); # default "WGS84"

🌈 METHODS 🌈

initialize

ellipsoid

Method to set or retrieve the current ellipsoid object. The ellipsoid is a Geo::Ellipsoids object. πŸ‘‘

my $ellipsoid = $gf->ellipsoid;  #Default is WGS84

$gf->ellipsoid('Clarke 1866'); #Built in ellipsoids from Geo::Ellipsoids
$gf->ellipsoid({a=>1});        #Custom Sphere 1 unit radius

forward

This method is the user frontend to the mathematics. This interface will not change in future versions. periodt. πŸ’…

my ($lat2, $lon2, $baz) = $gf->forward($lat1, $lon1, $faz, $dist);

Note: Latitude and longitude units are signed decimal degrees. The distance units are based on the ellipsoid semi-major axis which is meters for WGS-84. The forward and backward azimuths units are signed degrees clockwise from North. 🧭

bbox

Returns a hash reference for the bounding box around a point with the given radius. πŸ“¦

my $bbox = $gf->bbox($lat, $lon, $radius); #isa HASH {north=>$north, east=>$east, south=>$south, west=>$west}

Note: This is not an optimised solution input is welcome β€” that's straight from the source, bestie, the author is lowkey asking for help. πŸ™ˆ

UOM: radius units of semi-major axis (default meters for WGS-84)


πŸ’€ BUGS πŸ’€

Please open an issue on GitHub. πŸ› (do it, bestie, they're literally asking)


πŸ“ LIMITS πŸ“

No guarantees that Perl handles all of the double precision calculations in the same manner as Fortran. 😭 fr fr, floating point is a whole situation.


πŸ‘‘ LICENSE πŸ‘‘

MIT License

Copyright (c) 2022 Michael R. Davis


⭐ SEE ALSO ⭐

Similar Packages

Geo::Distance, Geo::Ellipsoid, Geo::Calc

Opposite Package

Geo::Inverse

Building Blocks

Geo::Ellipsoids, Geo::Constants, Geo::Functions


and that's the whole page, bestie! 🫢 this was perl v5.42.0, dated 2025-07-25, and it's the Geo::Forward(3) page from the User Contributed Perl Documentation. slay, go forward in a straight line responsibly. πŸŒΈβœ¨πŸ’–

πŸ“¦ where this page comes from