All Collections
API: Display Route Results on Your Own Map
API: Display Route Results on Your Own Map

Query our API to also return polyline data, and use that to draw route lines on a mapping service.

Marc Kuo avatar
Written by Marc Kuo
Updated over a week ago

Links: Platform API documentation / Engine API documentation

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).

The polyline data 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.

If you are using version 1.x of our API, please set the parameter "polylines: true" in the options object to get the polylines for each route.

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?