如何使用 addLayer() 将标准标记添加到 Mapbox

How do I add standard markers to Mapbox using addLayer()

如果你简单地添加一个标记,你会得到一个标准标记:

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()

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

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

我想您只需要遍历任何数据并为每个数据使用 addMarker()