2014-11-06 2 views
0

내 프로젝트에서 리플릿 맵을 사용하고 있습니다.나뭇잎 사이의 거리 표시

Suppose I have two markers in my map say A and B 
then how can i show direction from A to B place using leaflet. 

모든 관련 예제는 ?? 또는 내가 사용할 수있는 다른 오픈 소스지도 ??

+0

누군가가 나에게 수정을,하지만 난 리플릿이 작업을 수행 할 수 있다고 생각하지 않습니다 . [** 라우팅 **] (http : //developer.mapquest)를 원한다면 [** MapQuest **] (http://developer.mapquest.com/web/products/open/sdk)를 사용할 수 있습니다 .com/web/documentation/open-sdk/javascript/v7.2/routing) – kei

답변

0

link과 같이 Leaflet Routing Machine 플러그인을 사용할 수 있습니다.

<link rel="stylesheet" href="leaflet-routing-machine.css" /> 
<script src="leaflet-routing-machine.min.js"></script> 

과 같은 것을 수행합니다 : 당신은 적절한 CSS와 JS 파일을 포함 할 필요가 내가 틀렸다면

var map = L.map('map'); 

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { 
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' 
}).addTo(map); 

L.Routing.control({ 
    waypoints: [ 
     L.latLng(57.74, 11.94), //first marker position 
     L.latLng(57.6792, 11.949) //second marker position 
    ] 
}).addTo(map);