Leaflet - Draw road path in real-time based on two marker

Mellorine picture Mellorine · Mar 14, 2016 · Viewed 13.7k times · Source

Here's the sample of application that draw road path based on two markers enter image description here

Sorry I cannot search the tutorial to create this one because I cannot determine the right keyword.

All i want is to place two markers, then the road path will be created between those markers. It will adjust as one marker is moved.

Please provide insights on how this can be achieved. A sample code is much appreciated. Thank you in advance.

Answer

Patrick picture Patrick · Jan 17, 2017

This is OSRM, the Open Source Routing Machine. Here is a demo: http://map.project-osrm.org/

You can actually use it through HTTP request in any language you want: Python, javascript, java, C, ... Check the doc!