The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Geo::Forward - Calculate geographic location from lat, lon, distance, and heading.

SYNOPSIS

  use Geo::Forward;
  my $obj = Geo::Forward->new(); # default "WGS84"
  my ($lat1,$lon1,$faz,$dist)=(38.871022, -77.055874, 62.888507083, 4565.6854);
  my ($lat2,$lon2,$baz) = $obj->forward($lat1,$lon1,$faz,$dist);
  print "Input Lat: $lat1  Lon: $lon1\n";
  print "Input Forward Azimuth: $faz\n";
  print "Input Distance: $dist\n";
  print "Output Lat: $lat2 Lon: $lon2\n";
  print "Output Back Azimuth: $baz\n";

DESCRIPTION

This module is a pure Perl port of the NGS program in the public domain "forward" by Robert (Sid) Safford and Stephen J. Frakes.

CONSTRUCTOR

new

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

  my $obj = 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=$obj->ellipsoid;  #Default is WGS84

  $obj->ellipsoid('Clarke 1866'); #Built in ellipsoids from Geo::Ellipsoids
  $obj->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.

  my ($lat2,$lon2,$baz) = $obj->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.

TODO

Add tests for more ellipsoids.

BUGS

Please log on RT and email to the geo-perl email list as well as the author.

SUPPORT

DavisNetworks.com supports all Perl applications including this package.

LIMITS

No guarantees that Perl handles all of the double precision calculations in the same manner as Fortran.

AUTHOR

  Michael R. Davis qw/perl michaelrdavis com/
  CPAN ID: MRDVT

LICENSE

Copyright (c) 2011 Michael R. Davis (mrdvt92)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Similar Packages

Geo::Distance, Geo::Ellipsoid

Opposite Packages

Geo::Inverse

Building Blocks

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