NAME

Algorithm::GooglePolylineEncoding - Google's Encoded Polyline Algorithm Format

SYNOPSIS

use Algorithm::GooglePolylineEncoding;
@polyline = ({lat => 52.5, lon => 13.4}, ...);
$encoded_polyline = Algorithm::GooglePolylineEncoding::encode_polyline(@polyline);

DESCRIPTION

Algorithm::GooglePolylineEncoding implements the encoded polyline algorithm format which is used in some parts of the Google Maps API. The algorithm is described in https://developers.google.com/maps/documentation/utilities/polylinealgorithm.

This module is a light-weight version of Geo::Google::PolylineEncoder, essentially just doing the encoding part without any line simplification, and implemented without any CPAN dependencies.

FUNCTIONS

encode_polyline(@polyline)

Take an array of {lat => ..., lon => ...} hashrefs and return an encoded polyline string. Latitudes and longitudes should be expressed as decimal degrees (DD; http://en.wikipedia.org/wiki/Decimal_degrees).

encode_level($level)

Return an encoded level.

encode_number($number)

Return just an encoded number (which may be a single longitude, or latitude, or delta).

decode_polyline($encoded)

Take an encoded polyline string and return a list of {lat => ..., lon => ...} hashrefs.

AUTHOR

Slaven Rezic <srezic@cpan.org>

COPYRIGHT

Copyright (c) 2009,2010,2012,2017,2018 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Geo::Google::PolylineEncoder