javascript - mapbox-gl 中的集群属性
问题描述
我想在我的地图上绘制集群,但不是文本字段内的点数
map.addLayer({
id: 'cluster-count',
type: 'symbol',
source: 'stations',
filter: ['has', 'point_count'],
layout: {
'text-field': '{point_count}',
//'text-field': ['number-format', ['get', {point_count}]],
'text-font': ['DIN Offc Pro Medium', 'Arial Unicode MS Bold'],
'text-size': 12
}
});
但与%。
像这样的东西:
{point_count / overall_number_of_points}
但我找不到那件事的任何例子。
解决方案
我认为您正在寻找Mapbox的数学表达式:
["/", number, number]: number
["%", number, number]: number
在你的情况下,它可能是这样的..
["%", ['get', 'point_count'], ['get', 'overall_number_of_points']]
推荐阅读
- ios - iOS 应用程序在 Publishing 中与 iphone 和 ipad 的兼容性问题
- apache-kafka - Kafka 在 EC2 上的 Docker 上使用 Hyperledger Fabric 记录巨大的大小
- jboss - 无法读取质询文件 [由 java.io.FileNotFoundException 引起:/jboss/standalone/tmp/auth/local4123__.challenge(没有这样的文件或目录)
- react-native - NativeBase:如何在 Toast 中居中文本?
- git - 用于 GIT 的 IBM DB2 解决方案
- c++ - 如何键入 UTF8 字符并转换为字节数组?
- html - 使用 flexbox 将标题与下面的内容对齐
- php - 相对于另一个数组的快速过滤
- protractor - 在 Protractor 的期望语句中使用 OR 运算符
- c++ - C ++匹配括号2解决方案不起作用