Filtering and interactivity

Your application now uses deck.gl layersarrow-up-right and charts/widgets, powered by your CARTO data sources. A potential next step is to add interactivity and filters in your application. For example:

  • Letting your users modify styles in your application

  • A dropdown that exposes different parameters for your users

  • Clicking on a bar chart to filter by that specific category

  • Letting users draw a custom polygon to filter the widgets

CARTO and deck.gl provide different tools for developers to implement this and other filtering/interactivity scenarios.

Styles and map interactivity

For all interactions with the map, we recommend taking a look at the deck.gl documentation.

Column-based filters

Filters based on columns (for example, a specific dropdown value or filtering by a specific category) can be applied easily using the utilities available in CARTO Filters.

Spatial filters

We typically distinguish two types of spatial filters

  • The deck.gl map viewport: the current viewState of the deck.gl map. In other words, what the user is viewing.

  • A custom polygon mask: a state boundary, a circle, or a custom polygon drawn by the user. For custom polygons we recommend using @deck.gl-community/editable-layersarrow-up-right, a community module maintained by CARTO.

Once you've defined your spatial filter, with the utilities available in CARTO Filters, and if needed, the mask extensionarrow-up-right in deck.gl, you can filter all the CARTO layers and widgets in your app.

Last updated

Was this helpful?