Skip to main content


In the Mapbox Style Specification, a filter is a property at the layer level that determines which features should be rendered in a style layer. Filters are written as expressions, which give you fine-grained control over which features to include: the style layer only displays the features that match the filter condition that you define. Filters are called predicates in iOS and macOS.

This code from the Filter symbols by text input example includes a filter expression that singles out all features where "icon" is equal to symbol (a variable that is set to the selected feature's icon property):

id: layerID,
type: 'symbol',
source: 'places',
layout: {
'icon-image': symbol + '-15',
'icon-allow-overlap': true
filter: ['==', 'icon', symbol]

Older versions of the Mapbox Style Specification used a property-based filter syntax. While that older syntax still works, it will ultimately be deprecated and replaced by filter expressions.

Related resources:

Was this page helpful?