LogoLogo
Sign upHelp CenterContactSocial
Home
Home
  • Overview
  • REST API
    • Getting started
    • Navigating maps and workspaces
    • Uploading files and URLs
    • Styling layers
    • Refreshing live data layers
    • Working with elements
    • Listening to updates using webhooks
    • API Reference
      • Authentication
      • Maps
      • Layers
      • Elements
      • Users
      • Comments
      • Embed Tokens
      • Sources
      • Projects
  • JS SDK
    • Getting started
    • General concepts
    • Controlling maps
    • Working with selection
    • Reading entities
    • Drawing elements
    • Working with layers
    • Layer filters
    • Building custom charts
    • Map interactions and viewport
    • Hiding and showing
    • Integrating with React
    • Sample application
    • Examples
    • API Reference
  • Felt Style Language
    • Getting started
    • Style definition blocks
      • The config block
      • The paint block
      • The label block
      • The legend block
      • The popup block
      • The attributes block
      • The filters block
    • Types of visualizations
      • Simple visualizations
      • Categorical visualizations
      • Numeric visualizations (color & size)
      • Heatmaps
      • Hillshade
    • Zoom-based Styling
      • Interpolators
    • Legends
    • Errors
    • Examples
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Felt Style Language
  2. Style definition blocks

The filters block

The filters block contains information on how the layer is being filtered before displaying. In order for a feature to be shown on the map it must evaluate the filter expression to true.

Filters are written using a JSON infix notation that looks like one of [identifier, operator, operand], true or false .

  • Valid identifiers are either a feature property or a nested expression.

  • Valid operators are:

    • "lt" – Less than

    • "gt" – Greater than

    • "le" – Less than or equal to

    • "ge" – Greater than or equal to

    • "eq" – Equal to

    • "ne" – Not equal to

    • "and" – And, cast to boolean

    • "or" – Or, cast to boolean

    • "cn" – Contains the operand, cast to string

    • "nc" – Does not contain the operand, cast to string

    • "in" – Contained in the operand list

    • "ni" – Not contained in the operand list

    • "is" – Used to match against null values

    • "isnt" – Used to match against null values

  • Operands are:

    • A numerical value, a string value, a boolean value

    • An array of numerical, string, or boolean values, a shorthand expanded to these patterns:

      • Input 1: [id, "in", [element1, …, elementN]

      • Expansion 1: id is equal (”eq”) to one of more of the elements

      • Input 2: [id, "ni", [element1, …, elementN]

      • Expansion 2: id is not equal (”ne”) to any of the elements

      • Not defined for operators other than "in" and "ni"

    • A nested expression

  • In cases of type mismatch cast the identifier value to the operand’s type

    • Type casting applies element-wise to lists with "in" and "ni" operators

Example of a filter block that filters out features with a value less than 50000 on the “acres” property
"filters": ["acres", "lt", 50000]
Example of a more complex filter block
"filters": [["acres", "ge", 50000], "and", ["acres", "le", 70000]]
PreviousThe attributes blockNextTypes of visualizations

Last updated 1 year ago

Was this helpful?