module Polylines
Overview
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...
Extended Modules
Defined in:
polylines.crConstant Summary
-
VERSION =
"0.2.0"
Instance Method Summary
-
#decode(polyline : String, precision : UInt8 = 5) : Array(Location)
Decode a polyline string to an array of tuple
{lat:, lng:}
. -
#encode(points : Array(LooseLocation), precision : UInt8 = 5) : String
Encode an array of tuple
{lat:, lng:}
to a polyline string.
Instance Method Detail
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.
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