Routing
Estimated reading time: 1 minuteJawg Routing is based on the OSRM Project which is a modern routing engine for shortest paths in road networks. OSRM based on open-source tools and powered entirely by OpenStreetMap data.
Endpoint
https://api.jawg.io/routing/route/v1/car/13.388,52.517;13.397,52.529?overview=false&access-token=
\___/ \_________/\______/\____/\_/\__/\__________________________/\_____________/\__________/
| / | / \ \ | | |
scheme domain API service version profile coordinates options authentication token
OSRM API
Check out the OSRM documentation.
Integration and Libraries
Display routes on a map
MapLibre can display the OSRM routes with a layer and a GeoJSON source. Check out the Display a route example.
Alternatively, the maplibre-gl-directions plugin to easily display a route and make it interactive to the user. Check out the Use maplibre-gl-directions plugin example.
If you are using Leaflet, the Leaflet Routing Machine library can be a good starting point for routing integrating to your maps.
Display the routing instructions
In order to display the routing steps (routing instructions) you can use the OSRM Text Instructions library. The library generates localized, human-readable turn instructions to be displayed visually or read aloud by a text-to-speech engine.