I try to do it but it doesn't work, below is my main code.
Asked
Active
Viewed 44 times
-1
-
2Would be better to add code inline in the query and not as an image. – Sid Feb 06 '23 at 11:03
-
Please provide enough code so others can better understand or reproduce the problem. – Community Feb 06 '23 at 14:47
1 Answers
0
You need to query the features on the Mapbox map
map.on('click', (e) => {
const point = new mapboxgl.Point(e.pixel[0], e.pixel[1]);
const features = mbMap.queryRenderedFeatures(point);
console.log(features);
});
https://codesandbox.io/s/mapbox-layer-forked-x8mocy?file=/main.js

Mike
- 16,042
- 2
- 14
- 30