module

Polylines

Encode and decode Google Polylines. To use it:

Polylines.encode([{lat: 38.5, lng: -120.2}, {lat: 40.7, lng: -120.95}])
Polylines.encode([[38.5, -120.2], [40.7, -120.95]])
Polylines.encode([{38.5, -120.2}, {40.7, -120.95}])
# => "_p~iF~ps|U_ulLnnqC"

Polylines.decode("_p~iF~ps|U_ulLnnqC")
# => [{lat: 38.5, lng: -120.2}, {lat: 40.7, lng: -120.95}]

You can also set precision in both methods as the second positionnal argument It will correspond to the number of values after the comma.

Please do not set precision to more than 10...

40 digits: You are optimistic about our understanding of the nature of distance itself.

Constants

VERSION = "0.2.0"

Instance methods

decode(polyline : String, precision : UInt8 = 5) : Array(Location)

Decode a polyline string to an array of tuple {lat:, lng:}. The precision corresponds to the number of values after the comma, usually between 0 and 9.

Source
encode(points : Array(LooseLocation), precision : UInt8 = 5) : String

Encode an array of tuple {lat:, lng:} to a polyline string. The precision corresponds to the number of values after the comma, usually between 0 and 9

Source

Nested types