Routing location error

Hi,
Just to outline my error and resolution while trying out the routing service so anyone else who tried can save a few hours of troubleshooting.

This resolution applies if you are following the example from github at https://github.com/sla-onemap/decode_route_example_javascript/blob/master/index.html

Following the example strictly will render the decoded routing polylines outside of the singapore map. The problem is aptly described here: https://stackoverflow.com/questions/39247286/polyline-encode-gets-wrong-lat-lng-after-decoding](https://stackoverflow.com/questions/39247286/polyline-encode-gets-wrong-lat-lng-after-decoding

Solution:
Change the floating precision from 6 to 5.

In index.html file, change this line:
var polyline = L.polyline(L.PolylineUtil.decode(geometryOfRoute, 6),{

to this line:
var polyline = L.polyline(L.PolylineUtil.decode(geometryOfRoute, 5),{

1 Like

Hi Zahadi,

Thanks for pointing this out! :slight_smile:

We used to decode using floating precision of 6. It has since changed.

Regards,
Kai