Astro-satpass

 view release on metacpan or  search on metacpan

eg/xml  view on Meta::CPAN


	$xw->dataElement(
	    elevation	=> sprintf(
		'%.2f', rad2deg( $event->{elevation} ) ),
	);

	# Emit the azimuth of the event

	$xw->dataElement(
	    azimuth	=> format_azimuth( $event->{azimuth} ),
	);

	# If at least one -more was seen, emit the illumination of the
	# event

	$opt{more}
	    and $xw->dataElement(
	    illumination => $event->{illumination},
	);

	# Emit an end tag for the event

	$xw->endTag( $event->{event} );

    }

    # Emit the end tag for the pass

    $xw->endTag( 'pass' );
}

# End the XML

$xw->endTag( 'transits' );
$xw->end();

# Convert azimuth to compass bearing

my @bearing;

BEGIN {
    @bearing = qw{
	N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW
    };
}

sub format_azimuth {
    my ( $azimuth ) = @_;
    return $bearing[ int( $azimuth * @bearing / TWOPI + 0.5 ) % @bearing ];
}

__END__

=head1 TITLE

xml - Represent a series of ISS passes in XML

=head1 SYNOPSIS

 eg/xml
 eg/xml '06-Jun-2011 noon CET' 3 -time_zone GMT
 eg/xml -help
 eg/xml -version

=head1 OPTIONS

The following options are recognized:

=over

=item -latitude

This option specifies the latitude of the observer, in degrees north of
the Equator. Latitudes south of the Equator are negative.

The default is 52.069858, which is the latitude of The Hague.

=item -longitude

This option specifies the longitude of the observer, in degrees east of
Greenwich. Longitudes west of Greenwich are negative.

The default is 4.291111, which is the longitude of The Hague.

=item -height

This option specifies the height of the observer above sea level, in
meters. Heights below sea level are negative.

The default is 4, which is the height of The Hague above sea level.

=item -horizon

This option specifies the observing horizon in degrees above the
geometric horizon. Passes that do not achieve this elevation above the
horizon will not be reported. Negative elevations may be specified.

The default is 10, which is the value Heavens Above appears to use.

=item -twilight

This option specifies the beginning or end of twilight, in degrees of
the upper limb of the Sun B<above> the geometric horizon. Normally this
will be a negative value. Passes will not be reported unless the Sun is
below this elevation for at least part of the pass.

The default is -3, which is more or less consistent with Heavens Above.

=item -more

This option specifies that more information be presented. If specified
once, all events in a pass will be provided; the tags will be the event
names. If specified twice, all passes will be provided, whether or not
the International Space Station is visible at any time during the pass.
If specified at all, the C<< <illumination> >> tag will be added to the
data emitted for each event.

=item -time_zone

This option specifies the time zone for the output time. The value must
be compatable with the L<DateTime|DateTime> module.



( run in 0.785 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )