样式层取决于多个要素属性

问题描述 投票:0回答:1

是否有根据其属性绘制特征的方法?例如,有一个具有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',
                }
            });
filter mapbox mapbox-gl-js
1个回答
0
投票

是,表达式不仅支持此功能:https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/

使用较新的语法,将可以正常工作:

'filter': ['>', ['get', 'level_a'], ['get', 'level_b']]
© www.soinside.com 2019 - 2024. All rights reserved.