1Geo::Inverse(3) User Contributed Perl Documentation Geo::Inverse(3)
2
3
4
6 Geo::Inverse - Calculate geographic distance from a lat & lon pair.
7
9 use Geo::Inverse;
10 my $obj = Geo::Inverse->new(); # default "WGS84"
11 my ($lat1,$lon1,$lat2,$lon2)=(38.87, -77.05, 38.95, -77.23);
12 my ($faz, $baz, $dist)=$obj->inverse($lat1,$lon1,$lat2,$lon2); #array context
13 my $dist=$obj->inverse($lat1,$lon1,$lat2,$lon2); #scalar context
14 print "Input Lat: $lat1 Lon: $lon1\n";
15 print "Input Lat: $lat2 Lon: $lon2\n";
16 print "Output Distance: $dist\n";
17 print "Output Forward Azimuth: $faz\n";
18 print "Output Back Azimuth: $baz\n";
19
21 This module is a pure Perl port of the NGS program in the public domain
22 "inverse" by Robert (Sid) Safford and Stephen J. Frakes.
23
25 new
26 The new() constructor may be called with any parameter that is
27 appropriate to the ellipsoid method which establishes the ellipsoid.
28
29 my $obj = Geo::Inverse->new(); # default "WGS84"
30
32 ellipsoid
33 Method to set or retrieve the current ellipsoid object. The ellipsoid
34 is a Geo::Ellipsoids object.
35
36 my $ellipsoid=$obj->ellipsoid; #Default is WGS84
37
38 $obj->ellipsoid('Clarke 1866'); #Built in ellipsoids from Geo::Ellipsoids
39 $obj->ellipsoid({a=>1}); #Custom Sphere 1 unit radius
40
41 inverse
42 This method is the user frontend to the mathematics. This interface
43 will not change in future versions.
44
45 my ($faz, $baz, $dist)=$obj->inverse($lat1,$lon1,$lat2,$lon2);
46
48 Add more tests.
49
51 Please send to the geo-perl email list.
52
54 No guarantees that Perl handles all of the double precision
55 calculations in the same manner as Fortran.
56
58 Michael R. Davis qw/perl michaelrdavis com/
59
61 Copyright (c) 2006 Michael R. Davis (mrdvt92)
62
63 This library is free software; you can redistribute it and/or modify it
64 under the same terms as Perl itself.
65
67 Net::GPSD Geo::Ellipsoid GIS::Distance::GeoEllipsoid
68
69
70
71perl v5.28.0 2007-04-07 Geo::Inverse(3)