Geo::Horizon - Calculate distance to the visual horizon
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";
A perl object for calculating the distance to the visual horizon on an ellipsoid.
my $gh = Geo::Horizon->new(); #default WGS84
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
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))
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
Dc = R acos(R / (R + h))
Please send to the geo-perl email list.
Michael R. Davis qw/perl michaelrdavis com/
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.
Geo::Ellipsoids Math::Trig
To install Geo::Horizon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Horizon
CPAN shell
perl -MCPAN -e shell install Geo::Horizon
For more information on module installation, please visit the detailed CPAN module installation guide.