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 http://code.google.com/intl/en/apis/maps/documentation/polylinealgorithm.html.

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. 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).

TODO

Implement decode_polyline.

AUTHOR

Slaven Rezic <srezic@cpan.org>

COPYRIGHT

Copyright (c) 2009 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