Search code examples
mapboxmapbox-gl

Style Filter for Mapbox: attribute not set


I am not sure if I am just blind, but. In Mapbox you can filter your dataset. So what I want is to display all lines of a given class, that have a certain attribute NOT set. I see options for Exists, Is and Is Not. But there is no Does not exist, right? Is there a way to define that? Or do I have to do that when exporting my dataset beforehand?

enter image description here


Solution

  • You will want to wrap your expression in the logical negation operator:

    ["!",{{your expression here}}]
    

    In Mapbox Studio, after creating the filter, you can switch from the UI editor to the JSON editor at the bottom of the pane:

    enter image description here