mapbox-gl-js: 0.33.1
When I tried to filter out null values like this:
filter: [
"!=",
"name",
null
]
But it warns:
string, number, or boolean expected, null found
You can do this currently with ['has', 'name'] filter. However we might want to support null as a valid value too. Did we consider this @jfirebaugh?
Yes, see https://github.com/mapbox/mapbox-gl-style-spec/pull/421. Main reason we haven't implemented it is in most cases you want ['has', 'name'], not ["!=", "name", null], because vector tiles don't support null (https://github.com/mapbox/vector-tile-spec/issues/62).
But geojson does suuport null
What would the semantics of has be for a null value then? Does a feature has a value, if that value is null? And is it really useful to be able to distinguish "", null and not-present?
@stevage I spent some time thinking about this while implementing https://github.com/mapbox/mapbox-gl-style-spec/pull/451. My conclusion was that we should be as true to the Javascript semantics as possible. This would suggest that we should support null in Map#setFilter. (undefined is a sticker case because it isn't supported in JSON.)
Ah, thanks for pointing me to that.


so it's awkward
or please do not render it when property==null
@zuo1188 I can top this! ;)

To me this is an important feature for data-driven styling. Because you get GeoJSON data often from external data sources, and null is a valid value.
I think an isNUll comparator would be handy.
Closing this, as it will be covered by the upcoming 'arbitrary expressions' feature https://github.com/mapbox/mapbox-gl-js/pull/4777
Most helpful comment
Yes, see https://github.com/mapbox/mapbox-gl-style-spec/pull/421. Main reason we haven't implemented it is in most cases you want
['has', 'name'], not["!=", "name", null], because vector tiles don't supportnull(https://github.com/mapbox/vector-tile-spec/issues/62).