Filtering and interactivity
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Your application now uses deck.gl layers 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.
For all interactions with the map, we recommend taking a look at the deck.gl documentation.
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.
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-layers
, 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 extension in deck.gl, you can filter all the CARTO layers and widgets in your app.