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
27 The new() constructor may be called with any parameter that is appro‐
28 priate to the ellipsoid method which establishes the ellipsoid.
29
30 my $obj = Geo::Inverse->new(); # default "WGS84"
31
33 ellipsoid
34
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
45 This method is the user frontend to the mathematics. This interface
46 will not change in future versions.
47
48 my ($faz, $baz, $dist)=$obj->inverse($lat1,$lon1,$lat2,$lon2);
49
51 Add more tests.
52
54 Please send to the geo-perl email list.
55
57 No guarantees that Perl handles all of the double precision calcula‐
58 tions in the same manner as Fortran.
59
61 Michael R. Davis qw/perl michaelrdavis com/
62
64 Copyright (c) 2006 Michael R. Davis (mrdvt92)
65
66 This library is free software; you can redistribute it and/or modify it
67 under the same terms as Perl itself.
68
70 Net::GPSD Geo::Ellipsoid GIS::Distance::GeoEllipsoid
71
72
73
74perl v5.8.8 2007-04-06 Geo::Inverse(3)