Geo::Forward(3)
π 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
- fedora 43: perl-Geo-Forward 0.16-7.fc43 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms