2017-09-13 1 views

Antwort

0

können Sie dieses Plugin verwenden: http://hgoebl.github.io/Leaflet.MultiOptionsPolyline/demo/

Sie die Geschwindigkeit für jeden Punkt in Ihrem GeoJSON Eigenschaften zu definieren.

Dann müssen Sie einfach diesen Code hinzufügen, nachdem:

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

Für die Geschwindigkeit: https://github.com/hgoebl/Leaflet.MultiOptionsPolyline/blob/master/demo/js/demo.js#L59-L80

Verwandte Themen