2017-09-13 7 views

답변

0

당신은이 플러그인을 사용할 수 있습니다. https://github.com/hgoebl/Leaflet.MultiOptionsPolyline/blob/master/demo/js/demo.js#L59-L80

: 속도에 대한

var myPolyline = L.multiOptionsPolyline(YourGeoJSONHere, { 
    multiOptions: { 
     optionIdxFn: function (latLng) { 
      var i, 
       speedThresholds = [5, 10, 15, 30]; 

      for (i = 0; i < speedThresholds.length; ++i) { 
       if (latLng.alt <= speedThresholds[i]) { 
        return i; 
       } 
      } 
      return speedThresholds.length; 
     }, 
     options: [ 
      {color: '#0000FF'}, {color: '#0040FF'}, 
      {color: '#0080FF'}, {color: '#00FFB0'} 
     ] 
    }, 
    weight: 5, 
    opacity: 0.9, 
    smoothFactor: 1 
}).addTo(layerTrace); 

:

그런 다음 당신은 단순히 한 후이 코드를 추가해야