0
votes

myFeatureProperty is is either true or false I want the filter to be true if it's value is true I tried this and I get an "emit validation error" (mapbox error doesn't say what is invalid):

let filter = ['==', ['get',"myFeatureProperty"],true, true, false]

Any idea why I get this error? I can't find any examples of this simple task. What is the proper expression syntax for mapbox-gl-js latest version?

Thanks, Donnie

1

1 Answers

1
votes

If your property contains actual boolean values, you can use them directly as the filter:

filter = ['get', 'myFeatureProperty']

If you really wanted to compare them explicitly to true and false it would be like this:

filter = ['==', ['get', 'myFeatureProperty'], true]