传单 - 在沿多线线的特定距离添加标记
我正在研究基于传单的地图,并想在沿多线线的特定距离上添加标记。
我已经看过并使作品类似(将标记添加到沿整个路线/多线线的距离标记的lefflet 中的多线距离的各种距离) - 但我只需要显示一个标记。
这是我认为我需要更新的代码部分,但不确定什么?
提前致谢 :-)
// coords (from gpx)
var coords =
[
[58.64385, -3.02631],[58.64385, -3.02631],[58.64359, -3.0291],[58.64375, -3.03169],[58.64368, -3.0321],[58.64355, -3.03239],[58.64327, -3.03267]
]
// polyline
var polyline = L.polyline(coords, {
distanceMarkers: { offset: 1600, iconSize: [20, 20] }
});
// zoom the map to the route
map.fitBounds(polyline.getBounds());
map.addLayer(polyline);
I'm working on a leaflet based map and would like to add a marker at a specific distance along a polyline.
I've seen and made work something similar (add marker on polyline due various distances of polyline in leaflet) that places distance markers along the whole route/polyline - but I only need to show a single marker.
Here's the section of code that I think I need to update, but not sure what?
thanks in advance :-)
// coords (from gpx)
var coords =
[
[58.64385, -3.02631],[58.64385, -3.02631],[58.64359, -3.0291],[58.64375, -3.03169],[58.64368, -3.0321],[58.64355, -3.03239],[58.64327, -3.03267]
]
// polyline
var polyline = L.polyline(coords, {
distanceMarkers: { offset: 1600, iconSize: [20, 20] }
});
// zoom the map to the route
map.fitBounds(polyline.getBounds());
map.addLayer(polyline);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我与Turf.fs一起使用的方式
this is how I made it work with Turf.fs