mapbox / mapbox/mapbox-gl-js

map.queryRenderedFeatures counts from different layers with shared sources

Open
#12,386 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**:
https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.js

**browser**:
Microsoft Edge - Version 107.0.1418.42
Chrome - Version 107.0.5304.107
Firefox - Version 106.0.5

### Steps to Trigger Behavior

1. Add new source
2. Add circle layer using source
3. Add symbol layer using source (two circle layers doesn't trigger the issue)
4. map.queryRenderedFeatures on circle layer also counts the symbol layer (suspected since hiding the symbol layer changes the count of the circle layer features)

### Link to Demonstration

https://jsfiddle.net/b1wt6a50/1/

### Expected Behavior
map.QueryRenderedFeatures features should not be affected by shared source layers properties

### Actual Behavior
map.QueryRenderedFeatures features is affected by shared source layers properties

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction at https://jsfiddle.net/b1wt6a50/1/ and compare map.queryRenderedFeatures results for the circle layer while hiding and showing the symbol layer. Trace the query behavior for layers sharing one source. Done means querying the circle layer is unaffected by the symbol layer's properties or visibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.