I am working with Mapbox GL JS and I have a specific requirement to display the number of markers in a cluster divided by 10 on the map.
To achieve this, I am utilizing the point_count and point_count_abbreviated attributes in the code snippet below:
map.addSource("uploaded-source", {
type: "geojson",
data: geoJSONcontent,
cluster: true,
clusterMaxZoom: 15,
clusterRadius: 50,
});
map.addLayer({
id: "cluster-count",
type: "symbol",
source: "uploaded-source",
filter: ["has", "point_count"],
layout: {
"text-field": "{point_count_abbreviated}",
"text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
"text-size": 12,
},
});
I am looking for a way to add point_count_abbreviated divided by a specific number to the map. However, I am facing difficulties due to my limited knowledge of JavaScript. I have attempted different approaches as shown below:
"text-field"://{point_count_abbreviated}/10
//String(Number("{point_count_abbreviated}")/10),
//"{point_count_abbreviated}".slice(0, -1),
//String(Number(['/', ["get", Number("{point_count_abbreviated}")], Number(10)]))