Acme-Geo-Whitwell-Name
view release on metacpan or search on metacpan
lib/Acme/Geo/Whitwell/Name.pm view on Meta::CPAN
a special 'sign consonant' is inserted into the (partial) name after the first
vowel is added, and the transliteration continues by choosing again from the
vowel table, then continuing to alternate again.
This is very orderly, but confusing to generate by hand (putting aside the
fact that no one in their right mind really wants to live in "Isilu Buban"
instead of Sydney, AU, or "Feiro Nyvout" instead of Washington, DC).
The generated names are guaranteed to have alternating consonants and vowels,
and should be pronounceable (though most likely bizarre). I have not been able
to locate the original documentation of the scheme, so I am unable to determine
why some example names are built in "reverse": with the first letter for the
latitude selected from the longitude table, and vice versa for the longitude. I
can only guess that the alternate construction was deemed more pronounceable or
"interesting". Since this is the case, I generate both alternatives so you can
choose the one that seems "better". In the cases of places like McMurdo Base
("Eeseepu Bymeem" or "Neeveil Amyny"), I'm not sure there I<is> a "better".
However, solely for the purposes of amusement, it can be interesting to find
out what a given location would have been called in the alternate universe
where Whitwell's scheme caught on.
lib/Acme/Geo/Whitwell/Name.pm view on Meta::CPAN
@vowel{@vowels} = ();
=head1 EXPORT
=head1 FUNCTIONS
=head2 to_whitwell($lat, $lon)
Generates a properly-capitalized Whitwell name from a latitude-longitude pair.
Latitude and longitude are truncated to the two digits after the decimal point,
in keeping with Whitwell's original scheme. Zeroes are added after the decimal
point as necessary.
North latitudes are positve, and south latitudes are negative. East longitudes
are positive, west longitudes are negative. Trailing E/W and N/S are converted
into the appropriate sign. If you supply both for some reason, trailing
sign indicators override signs.
Returns both alternatives for the name (see L<SCHEME>).
=cut
lib/Acme/Geo/Whitwell/Name.pm view on Meta::CPAN
$value .= "E";
}
}
my $lon = $value;
return ($lat, $lon);
}
sub _coord_for {
my($original) = my($string) = @_;
# Determine if the string starts in the vowel table or the consonant table.
my @tables = (\@consonants, \@vowels);
my $vowel_found;
my $current = ($string =~ /^[aeiouy]/) || 0;
# Decompose and look up the character(s).
my $coord_string;
my $try_sign = 0;
my $is_negative = 0;
lib/Acme/Geo/Whitwell/Name.pm view on Meta::CPAN
if ($string =~ s/^$char//) {
# Found it. Tack the number onto the coordinate string,
# swap tables, and see if we need to check the sign.
$coord_string .= $i;
$try_sign = ($current == 1 and !$sign_checked);
$current = !$current;
next PARSE;
}
}
# The current table should have matched, so the input string is bad.
croak "Bad character or sequencing found in '$original' at '$string'";
}
# Insert the decimal point such that the resulting number is < 180.
# This allows "high-precision" Whitwell names (constructed in some
# manner other than via to_whitwell) to be converted back correctly.
if (length($coord_string) >= 3) {
# Need to insert a decimal point. The final value must be < 180,
# and we asssume at least two decimal places.
# Let's try the easy case first, and insert a decimal point
# right before the last two digits. All names generated via
( run in 1.336 second using v1.01-cache-2.11-cpan-f985c23238c )