带D3折线的传单 [英] Leaflet with D3 polylines

查看:80
本文介绍了带D3折线的传单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将D3用于Leaflet中的折线?

Is it possible to use D3 for polylines in Leaflet?

我试图实现的是一种不太准确但风格更多的路线显示.我想在贯穿Leaflet中每个标记点并创建一条平滑曲线的线(或路径)上使用d3的插值(单调").

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.

我发现的唯一一个与此类似的例子是 http://erasmus.ahoi.in ,它创建的很好使用d3和画布使圆弧平滑.

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

有人知道这个例子吗?

我已经在Leaflet地图上创建了带有一些标记的小提琴,以防有人想要射击: http://fiddle.jshell.net/zw8TR/10/

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/

推荐答案

Mike Bostock(D3的创建者)撰写了一篇不错的教程,介绍如何将D3与Leaflet结合使用.他在示例中使用了GeoJSON多边形,但可以轻松地将它们与您需要的GeoJSON线串交换.

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.

请参阅: http://bost.ocks.org/mike/leaflet/

这篇关于带D3折线的传单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆