如何添加point_count被某个值划分为映射
使用Mapbox GL JS,我想将其添加到地图上的群集中的标记数除以10。
我可以添加point_count和point_count_abbreviated属性如下:
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,
},
});
我如何添加point_count_abbreviation dive dive dive dive subly MAP?
不幸的是,我的JS知识不是那么先进,我尝试了类似的事情:
"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)]))
Using Mapbox GL JS I want to add to the map the number of markers in a cluster divied by 10.
I can add the point_count and point_count_abbreviated attributes as following:
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,
},
});
How do I add point_count_abbreviated divided by some number to the map?
Unfortunately my JS knowledge is not that advanced, I tried things like:
"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)]))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个 mapbox gl expression 。
我不确定是否需要将其转换为字符串。如果是这样:
You need a Mapbox GL expression.
I'm not sure if it needs to be converted to a string. If so: