setFilter method
Sets the filter for the specified style layer.
@param {string} layerId The ID of the layer to which the filter will be applied.
@param {Array | null | undefined} filter The filter, conforming to the Mapbox Style Specification's
filter definition. If null
or undefined
is provided, the function removes any existing filter from the layer.
@param {Object} options
@param {boolean} options.validate=true
Whether to check if the filter conforms to the Mapbox GL Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.
@returns {MapboxMap} this
@example
map.setFilter('my-layer', '==', 'name', 'USA'
);
@see Filter features within map view @see Highlight features containing similar data @see Create a timeline animation
Implementation
MapboxMap setFilter(String layerId, dynamic filter,
[StyleSetterOptions? options]) =>
MapboxMap.fromJsObject(jsObject.setFilter(layerId, filter));