最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin3浏览0评论

Here's the sample of application that draw road path based on two markers

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.

Here's the sample of application that draw road path based on two markers

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.

Share Improve this question asked Mar 14, 2016 at 13:16 MellorineMellorine 2851 gold badge5 silver badges14 bronze badges 3
  • 4 You are probably looking for Leaflet Routing plugins? – ghybs Commented Mar 14, 2016 at 16:42
  • 2 Do you mean that the path should be recalculated while dragging? See the routeWhileDragging attribute in the LRM plugin: liedman/leaflet-routing-machine/tutorials/… – Karussell Commented Mar 14, 2016 at 21:30
  • Yes sirs, i just want to draw road path in real-time that is always in road, just like in other website that offers this feature – Mellorine Commented Mar 21, 2016 at 11:57
Add a ment  | 

1 Answer 1

Reset to default 8

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

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

发布评论

评论列表(0)

  1. 暂无评论