更改mapbox群集映射中的文本颜色

Fel*_*lix 1 javascript mapbox mapbox-gl

我正在尝试更改地图集群集地图中的文本颜色(https://www.mapbox.com/mapbox-gl-js/example/cluster/),但我无法弄清楚如何.

以下是相关代码:

map.addLayer({
    id: "cluster-count",
    type: "symbol",
    source: "grundbuch",
    filter: ["has", "point_count"],
    layout: {
        "text-field": "{point_count_abbreviated}",
        "text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
        "text-size": 12
    }
});
Run Code Online (Sandbox Code Playgroud)

有人知道怎么做这个吗?我想将数字标签更改为白色.

Den*_*soi 15

要更改地图图层中的文本颜色,您需要使用该"paint"属性来设置text-color属性REF:

paint: {
  "text-color": "#ffffff"
}
Run Code Online (Sandbox Code Playgroud)

map.addLayer({
  id: "cluster-count",
  type: "symbol",
  source: "grundbuch",
  filter: ["has", "point_count"],
  layout: {
    "text-field": "{point_count_abbreviated}",
    "text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
    "text-size": 12
  },
  paint: {
    "text-color": "#ffffff"
  }
});
Run Code Online (Sandbox Code Playgroud)