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

NAME

Geo::Horizon - Calculate distance to the visual horizon

SYNOPSIS

  use Geo::Horizon;
  my $gh = Geo::Horizon->new("WGS84");
  my $lat=39;
  my $alt=1.7;
  my $distance_to_horizon=$gh->distance($alt,$lat);
  print "Input Lat: $lat1\n";
  print "Output Distance: $dist\n";

DESCRIPTION

A perl object for calculating the distance to the visual horizon on an ellipsoid.

CONSTRUCTOR

new

  my $gh = Geo::Horizon->new(); #default WGS84

METHODS

ellipsoid

Method to set or retrieve the current ellipsoid object. The ellipsoid is a Geo::Ellipsoids object.

  my $ellipsoid=$gh->ellipsoid;  #Default is WGS84

  $gh->ellipsoid('Clarke 1866'); #Built in ellipsoids from Geo::Ellipsoids
  $gh->ellipsoid({a=>1});        #Custom Sphere 1 unit radius

distance

The straight-line of sight distance to the horizon: This formula does not take in account radio or optical refraction which will be further the longer the wavelength.

  my $dist=$obj->distance($alt, $lat);  #alt in meters (ellipsoid units)
                                        #lat in signed decimal degrees
  my $dist=$obj->distance($alt);        #default lat => 0 (equator)
  my $dist=$obj->distance;              #default alt => 1.7

Formula from http://newton.ex.ac.uk/research/qsystems/people/sque/physics/horizon/

  Ds = sqrt(h(2R + h))

distance_great_circle

The curved distance along the ellipsoid to the horizon: This is the great circle distance from the track point snapped to the ellipsoid to the visual horizon of the observer.

  my $dist=$obj->distance_great_circle($alt, $lat);
  my $dist=$obj->distance_great_circle($alt);  #default lat => 0
  my $dist=$obj->distance_great_circle();      #default alt => 1.7

Formula from http://newton.ex.ac.uk/research/qsystems/people/sque/physics/horizon/

  Dc = R acos(R / (R + h))

TODO

BUGS

Please send to the geo-perl email list.

LIMITS

AUTHOR

Michael R. Davis qw/perl michaelrdavis com/

LICENSE

Copyright (c) 2006 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

Geo::Ellipsoids Math::Trig