Dynamically set filtering based on another layer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
I have two layers, one is the polygons with yellow outlines and the other one is the purple dots. I want to highlight the yellow outlined polygons by filling them blue when there's one or multiple purple dots on them, but I couldn't find a good way to do so.

## Design Alternatives
The closest thing I could find is "within" (https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/#within) that I can use in expressions, but it only returns true when the features is **fully** contained inside the input geometry.
## Design
I would suggest adding another expression called "touch", which is similar to "within", but instead of only "returns true if the evaluated feature is fully contained inside a boundary of the input geometry", we can make it "returns true if the evaluated feature touches the boundary of the input geometry"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files or tests. Start by reviewing the style-spec documentation for the existing `within` expression and how filtering is evaluated across layers, then clarify the intended boundary-intersection semantics. Done means the expression behavior is agreed and can identify polygon features touched by points from another layer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100