Algorithm-GooglePolylineEncoding
view release on metacpan or search on metacpan
GooglePolylineEncoding.pm view on Meta::CPAN
# amount, which increases by 5 bits each time. OR the
# value into $results, which sums up the individual 5-bit
# chunks into the original value. Since the 5-bit chunks
# were reversed in order during encoding, reading them in
# this way ensures proper summation.
$result |= ($b & 0x1f) << $shift;
$shift += 5;
}
# Continue while the read byte is >= 0x20 since the last
# `chunk` was not OR'd with 0x20 during the conversion
# process. (Signals the end)
while ($b >= 0x20);
use integer; # see last paragraph of "Integer Arithmetic" in perlop.pod
# Check if negative, and convert. (All negative values have the last bit
# set)
my $dtmp = (($result & 1) ? ~($result >> 1) : ($result >> 1));
# Compute actual latitude (resp. longitude) since value is
# offset from previous value.
( run in 0.425 second using v1.01-cache-2.11-cpan-8d75d55dd25 )