Plotting Routing Service Response

Hi,

I am trying to visualize the routing response between two given locations. I am using Python to interact with API service. I manage to get the json response and decode the route geometry into a list of coordinates in lat lng format. I assume they are the geocodes for the via points and correct me if I am wrong.

The question is, how do I get to plot out the routing properly? Since in the documentation it states it returns drawn path of the route while I am only getting the textual json response, is there a method or attribute that I can call to directly visualize it? Or do I need to use Leaflet to plot them out in an additional step? I would prefer to have them visualized in a smooth path polyline, with instruction annotated.

Thank you,
Byron

The JSON response of the route instruction won’t tag to the route geometry (after decoded). It is used to show as a separate panel for the route info.

You can extend your user experience to allow the user to select the route instruction (like Onemap Drive Mode Panel) with tagging to the JSON response (lat, lng) to zoom to this lat, lng as another layer.

Hi Kyros,

Thanks for the response. Can you instruct on how can I get the above visualization from the routing service API response, with ployline superimposed on One Map (or other maps)?

@byron,

You can refer to this Leaflet Plugin: https://github.com/jieter/Leaflet.encoded