- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用 react-map-gl 添加连接线到 map 标记?
例如:我有 3 个标记(mark1、mark2、mark3)
mark1 应该连接到 mark2 & mark3 。mark2 应该连接到 mark1 &mark 3....谁能帮帮我...
最佳答案
几种方式:
1) 可能最好的方法是使用deck.gl
LineLayer . Deck.gl 旨在与 react-map-gl
一起使用,所以我想这是 react-map-gl 的
预期解决方案。
2) 在 map 上设置一个 ref,然后向 map 添加一个图层:
<ReactMapGL
id={'map'}
ref={'map'}
onLoad={this.addLines}
.... />
addLines = () => {
const map = this.refs.map.getMap()
map.addLayer({
"id": "route",
"type": "line",
"source": {
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[-122.48369693756104, 37.83381888486939],
[116.48348236083984, 37.83317489144141],
]
}
}
},
"layout": {
"line-join": "round",
"line-cap": "round"
},
"paint": {
"line-color": "#888",
"line-width": 8
}
});
}
3) 通过 mapStyles Prop 设置 geojson,如 this 中所示例子
关于react-map-gl - 如何使用 react-map-gl 将连接线添加到 map 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47790967/
我有如下所示的文本文件: 1. SometextSometextSometextSometextSometext 2. SometextSometextSometextSometextSometext
这一章实现的连接线,目前仅支持直线连接,为了能够不影响原有的其它功能,尝试了2、3个实现思路,最终实测这个实现方式目前来说最为合适了。 请大家动动小手,给我一个免费的 Star 吧~ 大家
假设我的流是 x*N 行长,其中 x 是记录数,N 是每条记录的列数,并且按列输出。例如,x=2,N=3: 1 2 Alice Bob London New York 我如何加入每一行,以记录数为模,
如何在下面的 jsfiddle 中用虚线连接数字。 我希望这些线从内圈的边界开始,无论是来自 jQuery 还是来自 css。我的意思是围绕内圈的边界从内边界边缘开始到数字 ....... 1, ..
我正在使用 C#,但将来我可能需要在其他语言上使用它。 很多游戏都有这样的谜题。有一组电线(有两种类型的电线:直的和弯的。),有一个地方是信号进来的地方,还有一个地方是信号必须离开的地方。但是电线的布
本章响应小伙伴的反馈,除了算法自动画连接线(仍需优化完善),实现了可以手动绘制直线、折线连接线功能。 请大家动动小手,给我一个免费的 Star 吧~ 大家如果发现了 Bug,欢迎来提 Is
使用新版本的 Java 物质外观,不绘制典型 JTree 中的连接线(父子线)。 在 java.net 的官方论坛上有人问 same thing开发人员对此的回答是,这是基于较新的 UI 的选择,并且
我正在使用 matplotlib 绘制一些数据,这些数据需要一段时间,因此我必须使用 plot_date 来绘制我的线条。但出于某种原因,就连接线而言,Plot_Date 和 Plot 具有完全不同的
我是一名优秀的程序员,十分优秀!