The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Sun::Bearing - Calculates the bearing from a station on the surface of the Earth to the Sun.

SYNOPSIS

  use Geo::Sun::Bearing;
  use GPS::Point;
  my $datetime=DateTime->now;
  my $station=GPS::Point->new(lat=>39, lon=>-77);
  my $gs=Geo::Sun::Bearing->new->set_datetime($datetime)->set_station($station);
  printf "Bearing from Station to Sun is %s\n", $gs->bearing;

DESCRIPTION

The Geo::Sun::Bearing is a Geo::Sun object. This package calculates the bearing from a station on the surface of the Earth to the point where the Sun is directly over at the given time.

USAGE

  use Geo::Sun::Bearing;
  my $gs=Geo::Sun::Bearing->new;

CONSTRUCTOR

new

  my $gs=Geo::Sun::Bearing->new; #Inherited from Geo::Sun
  my $gs=Geo::Sun::Bearing->new(datetime=>$dt, station=>$station);

METHODS

Many methods are inherited from Geo::Sun.

bearing

Returns the bearing from the station to the Sun.

bearing_dt_pt

Returns bearing given a datetime and a station point.

  my $bearing=$gs->bearing_dt_pt($datetime, $station);

Implemented as

  my $bearing=$gs->set_datetime($datetime)->set_station($station)->bearing;

station

Sets or returns station. Station must be a valid point argument for GSP::Point distance method. Currently, Geo::Point and GPS::Point. I'm planning to add {lat=>$lat, lon=>$lon} and [$lat, $lon] shortly.

set_station

Sets station returns self

METHODS (INTERNAL)

point_onchange

Overridden from Geo::Sun to recalculate the bearing when the point changes

bearing_recalculate

Method which is called to recalculate the bearing when the datetime or the station is changed.

bearing_onchange

In this base module this does nothing but to return the object

Override this function if you want to calculate something when the bearing changes. By nature this hook also gets called when point_onchange is called so don't override both.

BUGS

Please send to the geo-perl email list.

SUPPORT

Try the geo-perl email list.

LIMITATIONS

Calculations are only good to about 3 decimal places.

AUTHOR

    Michael R. Davis
    CPAN ID: MRDVT
    STOP, LLC
    domain=>stopllc,tld=>com,account=>mdavis
    http://www.stopllc.com/

COPYRIGHT

This program is free software licensed under the...

        The BSD License

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO