没有图块的 Mapbox js 地图

Mapbox js map without tiles

我想使用 mapbox 框架显示等值线。我已经有一个使用 mapbox.light 样式的工作示例。我想要实现的是拥有一张只显示多边​​形的空白地图。简而言之,我想禁用 mapbox 平铺。这可能吗?我一直在尝试使用 d3 实现同样的事情,但没有任何运气。

您可以隐藏图层:

mapbox:

map.eachLayer( function(t,e) {
  if (t.setOpacity) t.setOpacity(0.5);
});

mapbox gl js:

map
  .getStyle() 
  .layers
  .forEach(function(layer) {  
    map.setLayoutProperty(layer.id, 'visibility', 'none');
  })