Geo-Coordinates-Transform
view release on metacpan or search on metacpan
lib/Geo/Coordinates/Transform.pm view on Meta::CPAN
unless( grep { $_ eq $func_ptr } qw( _cnv_to_dd _cnv_to_ddm _cnv_to_dms ) ) { return }
# Validate input
if ( ref $lst_ref ne 'ARRAY' ) { die "Array reference is expected as input" }
my @ll_out_lst;
foreach my $ll ( @{$lst_ref} )
{
if ( $ll =~ /([^-+\s\d\.]+)/ )
{
push @ll_out_lst, 'NaN';
warn "Illegal char in $ll";
}
else
{
no strict 'refs';
push @ll_out_lst, $self->${func_ptr}($ll);
}
}
return \@ll_out_lst;
lib/Geo/Coordinates/Transform.pm view on Meta::CPAN
=head1 DESCRIPTION
There are several formats used to present geographic coordinates. For example:
* DMS Degrees:Minutes:Seconds (48 30 30, -117 30' 30")
* DM Degrees:Decimal-Minutes (48 30.5, -117 30.5'),
* DD Decimal-Degrees (48.5083333, -17.5083333)
This module converts a list of provided latitude and longitude coordinates in any of the three
formats above (mixed input is ok) and converts to the desired format. Note that special characters
or non-numerical characters such as " will throw an warning and return NaN for that list item.
In addition, the input does not interpert N,S,W,E designators but expects coordinates to be in
positive or negative representation.
Format of the output can be controlled via input arguments in the constructor. The arguments are expected
to be in the form of a hash reference. For example:
# Change output format
# Hash aruements are
# 'dd_fmt' = Decimal-Degrees format
( run in 0.551 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )