是否有根据其属性绘制特征的方法?例如,有一个具有int属性“ level_a”和“ level_b”的Feature,需要填充哪个Feature取决于哪个属性更大。由于过滤器仅支持[">", feature(key), value]
,因此无法直接比较它们,并且功能可能位于同一层。谢谢。
需要类似的东西:
map.addLayer({
'id': 'foo',
'type': 'fill',
'source': 'source',
'filter': ['>', 'level_a', 'level_b'], //cannot insert properties directly an value field
'paint': {
'fill-color': '#blue',
}
});
是,表达式不仅支持此功能:https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/
使用较新的语法,将可以正常工作:
'filter': ['>', ['get', 'level_a'], ['get', 'level_b']]