1Geo::Inverse(3) User Contributed Perl Documentation Geo::Inverse(3)
2
3
4
6 Geo::Inverse - Calculate geographic distance from a latitude and
7 longitude pair
8
10 use Geo::Inverse;
11 my $obj = Geo::Inverse->new(); #default "WGS84"
12 my ($lat1, $lon1, $lat2, $lon2) = (38.87, -77.05, 38.95, -77.23);
13 my ($faz, $baz, $dist) = $obj->inverse($lat1,$lon1,$lat2,$lon2); #array context
14 my $dist=$obj->inverse($lat1, $lon1, $lat2, $lon2); #scalar context
15 print "Input Lat: $lat1 Lon: $lon1\n";
16 print "Input Lat: $lat2 Lon: $lon2\n";
17 print "Output Distance: $dist\n";
18 print "Output Forward Azimuth: $faz\n";
19 print "Output Back Azimuth: $baz\n";
20
22 This module is a pure Perl port of the NGS program in the public domain
23 "inverse" by Robert (Sid) Safford and Stephen J. Frakes.
24
26 new
27 The new() constructor may be called with any parameter that is
28 appropriate to the ellipsoid method which establishes the ellipsoid.
29
30 my $obj = Geo::Inverse->new(); # default "WGS84"
31
33 initialize
34 ellipsoid
35 Method to set or retrieve the current ellipsoid object. The ellipsoid
36 is a Geo::Ellipsoids object.
37
38 my $ellipsoid = $obj->ellipsoid; #Default is WGS84
39
40 $obj->ellipsoid('Clarke 1866'); #Built in ellipsoids from Geo::Ellipsoids
41 $obj->ellipsoid({a=>1}); #Custom Sphere 1 unit radius
42
43 inverse
44 This method is the user frontend to the mathematics. This interface
45 will not change in future versions.
46
47 my ($faz, $baz, $dist) = $obj->inverse($lat1,$lon1,$lat2,$lon2);
48
50 Please open an issue on GitHub
51
53 No guarantees that Perl handles all of the double precision
54 calculations in the same manner as Fortran.
55
57 MIT License
58
59 Copyright (c) 2022 Michael R. Davis
60
62 Geo::Ellipsoid, GIS::Distance::GeoEllipsoid, Geo::Calc
63
64
65
66perl v5.38.0 2023-07-20 Geo::Inverse(3)