All Projects → joshuaclayton → Polylines

joshuaclayton / Polylines

Licence: mit
Easily handle Google polylines

Programming Languages

ruby
36898 projects - #4 most used programming language

Polylines

Easily handle Google polylines

Install

Install with Rubygems:

gem install polylines

Usage

To encode an array of latitude/longitude pairs:

>> Polylines::Encoder.encode_points([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]])
=> "_p~iF~ps|U_ulLnnqC_mqNvxq`@"

To decode a polyline into an array of latitude/longitude pairs:

>> Polylines::Decoder.decode_polyline("_p~iF~ps|U_ulLnnqC_mqNvxq`@")
=> [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]

I wrote this to follow the steps outlined in http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html.

License

Please see LICENSE

Author

Written by Josh Clayton

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].