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
11.11k stars 2.21k forks source link

How do I query features for the vector tilesets even they are not visible on the map? #13194

Closed bitcooker closed 1 week ago

bitcooker commented 3 months ago

Question

Hello, I'm trying to find a way to query features of vector tilesets when they are not visible.

I tried querySourceFeatures(), but it's not working.

Please let me know how can I implement this.

Thanks

stepankuzmin commented 1 week ago

Hi @bitcooker,

The querySourceFeatures returns features only from the currently loaded vector tiles and GeoJSON source tiles. This function does not check tiles outside the currently visible viewport. Unfortunately, it's not currently possible to query the features in the tiles that weren't loaded.