多个标记-相同的坐标 [英] Multiple markers - Same coordinates
问题描述
尝试在完全相同的坐标上显示2个不同的标记时遇到麻烦.
I'm having some troubles trying to display 2 different markers placed at exactly the same coordinates.
情况是:我们正在显示商店,其中一些位于同一建筑物(即购物中心),因此它们是不同的商店,但具有相同的ubiubi/坐标.
The case is: we are displaying stores, and some of them are placed at the same building (ie. a mall), so, they are different stores but shares the same ubication/coordinates.
我们的json源内容如下:
Our json source content looks like this:
{
"properties" : {
"id" : "1",
"name" : "Store 1"
},
"geometry" : {
"coordinates" : [-70.66667, -33.45],
"type" : "Point"
}
},
{
"properties" : {
"id" : "2",
"name" : "Store 2"
},
"geometry" : {
"coordinates" : [-70.66667, -33.45],
"type" : "Point"
}
}
问题是,其中只有一个显示出来.
The thing is, just one of them gets displayed.
我的问题是,此用例是否有现成的解决方案?还是应该实施自己的解决方案?
My question is, is there an out of the box solution for this use-case? Or should we implement our own solution ?
提前谢谢!
推荐答案
如果您使用的是mapbox-gl中的 Marker
类,则只需应用标准CSS transform
偏移标记.
If you are using the Marker
class from mapbox-gl, you can just apply standard CSS transform
to offset the marker.
另一种解决方案是将其称为蜘蛛标记":
Another solution would be something refered to as "spider marker":
- https://bewithjonam.github.io/mapboxgl-spiderifier/docs/index.html
- https://github.com/bewithjonam/mapboxgl-spiderifier
这篇关于多个标记-相同的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!