Leaflet with D3 polylines

独自空忆成欢 提交于 2020-01-25 03:00:31

问题


Is it possible to use D3 for polylines in Leaflet?

What I am trying to achieve is a less accurate, but more stylised, route display. I'd like to use d3's interpolation('monotone') on a line (or path) which runs through each marker point in Leaflet and creates a smooth, curved line.

The only example I have found close to this is http://erasmus.ahoi.in which creates nice smooth arcs using d3 and canvas.

Does anyone know of any examples of this?

I have created a fiddle with some markers on a Leaflet map in case someone wants to give it a shot: http://fiddle.jshell.net/zw8TR/10/


回答1:


Mike Bostock (the creator of D3) has written a nice tutorial on how to use D3 in combination with Leaflet. He uses GeoJSON polygons in his example but they can easily be swapped with GeoJSON linestrings, which you would be needing.

See: http://bost.ocks.org/mike/leaflet/



来源:https://stackoverflow.com/questions/20897985/leaflet-with-d3-polylines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!