多个标记 - 相同坐标

Cla*_*voa 7 mapbox mapbox-gl mapbox-gl-js mapbox-marker

我在尝试显示放置在完全相同的坐标处的 2 个不同标记时遇到了一些麻烦。

情况是:我们正在展示商店,其中一些商店位于同一栋建筑(即购物中心),因此,它们是不同的商店,但共享相同的公共/坐标。

我们的 json 源内容如下所示:

  {
     "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"
     }
  }
Run Code Online (Sandbox Code Playgroud)

问题是,只有其中一个被显示。

我的问题是,对于这个用例是否有开箱即用的解决方案?或者我们应该实施我们自己的解决方案?

提前致谢!

Sca*_*ize 5

如果您使用的Marker是 mapbox-gl 中的类,则只需应用标准 CSStransform即可偏移标记。

另一种解决方案是所谓的“蜘蛛标记”: