> For the complete documentation index, see [llms.txt](https://docs.carto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carto.com/carto-for-developers/key-concepts/filtering-and-interactivity.md).

# Filtering and interactivity

Your application now uses [deck.gl layers](https://github.com/CartoDB/gitbook-documentation/blob/master/carto-for-developers/key-concepts/carto-for-deck.gl) and [charts/widgets](/carto-for-developers/key-concepts/charts-and-widgets.md), powered by your [CARTO data sources.](/carto-for-developers/key-concepts/data-sources.md) 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](/carto-for-developers/reference/filters.md).

## 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-layers`](https://www.npmjs.com/package/@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](/carto-for-developers/reference/filters.md), and if needed, the [mask extension](https://deck.gl/docs/api-reference/extensions/mask-extension) in deck.gl, you can filter all the CARTO layers and widgets in your app.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.carto.com/carto-for-developers/key-concepts/filtering-and-interactivity.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
