问题
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