【问题标题】:How do I add standard markers to Mapbox using addLayer()如何使用 addLayer() 向 Mapbox 添加标准标记
【发布时间】:2020-11-10 22:39:27
【问题描述】:

如果你只是添加一个标记,你会得到一个标准标记:

https://docs.mapbox.com/mapbox-gl-js/example/add-a-marker/

如果您使用 addLayer(),似乎没有任何关于如何使用这些标准标记的描述:

https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#symbol

map.addLayer({
    'id': 'POIs',
    'type': 'symbol',
    'source': 'POIs',
    'layout': {
        'icon-image': 'marker-15',  // this is a custom image... I just want a default, normal marker
        'icon-allow-overlap': true
    }
});

添加特殊符号真的很容易,但我只想要默认标记。 如何使用 addLayer() 完成此操作

【问题讨论】:

    标签: mapbox-gl-js


    【解决方案1】:

    非常令人失望的消息。不知何故,这是不可能的:

    https://github.com/mapbox/mapbox-gl-js/issues/656

    我猜你只需要遍历你的数据并为每个数据使用addMarker()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      • 2019-09-26
      • 1970-01-01
      相关资源
      最近更新 更多