首页 > 解决方案 > 传单:绘制带有线条和箭头样式的 .gpx 路径

问题描述

我对传单有点陌生,但是我花了几个小时却无法解决这个问题:我想使用 gpx 文件作为源来绘制一条带箭头的线。这应该在可以显示或不使用覆盖的图层中。我设法设置箭头或线条的样式,但我没有设法同时设置样式。这是我的代码:谁能给我关于如何设计线条的建议?非常感谢。

var customLayer = L.geoJson(null, {onEachFeature: function (feature, layer) {
   L.polylineDecorator(layer, {
      patterns: [   
        {offset: 25, repeat: 15, symbol: L.Symbol.arrowHead({pixelSize: 10, pathOptions: {stroke: false, color: '#000', fillOpacity: 1, weight: 0}})}
      ]
    }).addTo(customLayer);  /// Adds each decorator to the map!!!!
  } 
}
);

var runLayer = omnivore.gpx('./FerneyGex.gpx', null, customLayer);
    controlLayers2.addOverlay(runLayer, 'Ferney - Gex');

标签: leaflet

解决方案


推荐阅读