mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
10.91k stars 2.2k forks source link

map.queryRenderedFeatures counts from different layers with shared sources #12386

Open nilsmf opened 1 year ago

nilsmf commented 1 year ago

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

nilsmf commented 3 months ago

Still active on latest gl-js version 3.3.0 https://jsfiddle.net/kyadwmu0/