If you want to display the route results on your own map, you can query our API to also return polyline data. You can use the polyline data to draw the route lines on any mapping service (e.g. Google Maps, Mapbox, Leaflet, etc).

Use the parameter "polylines: true" in the options object to get the polylines for each route. They will be in an encoded format, and you can use something like this to decode it. After it is decoded, you will have an array of lat/lng pairs, which you can then draw on your map.

NOTE: the encoded polyline string may include backslashes, so make sure you don't escape them, otherwise the polylines may end up all over the place! See Stack Overflow for more info.

ANOTHER NOTE: if you are seeing that your coordinates are off by a decimal point, try using a different "precision" value.


Did this answer your question?