2016-09-08 3 views
0

新しいOSRMを取得する際にいくつか問題がありますが、概要=フルでリクエストを送信できません。OSRM 5概要を得る方法=完全

マイコード:

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

var control = L.Routing.control(L.extend(window.lrmConfig, { 
    //router: routera 
    waypoints: [ 
     L.latLng(52.4, 11.44), 
     L.latLng(52.92, 11.65) 
    ], 
    geocoder: L.Control.Geocoder.nominatim(), 
    routeWhileDragging: true, 
    reverseWaypoints: false, 
    showAlternatives: true, 
    altLineOptions: { 
     styles: [ 
      {color: 'black', opacity: 0.15, weight: 9}, 
      {color: 'white', opacity: 0.8, weight: 6}, 
      {color: 'blue', opacity: 0.5, weight: 2} 
     ] 
    } 
})).addTo(map); 

私はルートを定義しようとしますが、動作しません。今すぐコードが正しいです。

+0

ルーター定義はどのように定義されていますか? – Phylogenesis

答えて

0

私は解決策を持っています。

router: L.Routing.osrmv1({ 
     routingOptions: { 
      alternatives: true, 
      steps: true, 
      geometryOnly: true 
     } 

フルコード。

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), 
     L.latLng(57.6792, 11.949) 
    ], 
    router: L.Routing.osrmv1({ 
     routingOptions: { 
      alternatives: true, 
      steps: true, 
      geometryOnly: true 
     } 
    }), 
    showAlternatives: true, 
    routeWhileDragging: true, 
    altLineOptions: { 
     styles: [ 
      {color: 'black', opacity: 0.15, weight: 9}, 
      {color: 'white', opacity: 0.8, weight: 6}, 
      {color: 'blue', opacity: 0.5, weight: 2} 
     ] 
    } 

}).addTo(map); 
関連する問題