-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
querySourceFeatures returns features outside the viewbox #13254
Comments
Perhaps we could improve the clarity of documentation about this. To see how this works, set |
Thanks for the clarification! Yeah, putting a sentence about it in docs would help. thanks! |
mapbox-gl-js version: 3.1.2
Question
We use
querySourceFeatures
to query features in our vector tiles (mvt).Based on the documentation, we would expect only features within the map viewport to be returned by the method. Relevant part of the docs:
The domain of the query includes all currently-loaded vector tiles and GeoJSON source tiles: this function does not check tiles outside the currently visible viewport.
What happens though is that the method sometimes returns features that are not within the viewport boundaries.
The only way I could explain that behavior is that it could happen if the we are in a state between 2 zoom levels meaning that the tile doesn't end precisely on the edge of the viewport so that a part of the tile is within the viewport and part is out. And in that case the method returns features within the tile but outside of the viewport.
Questions are:
PS.
Another source of confusion is that the description says the method behaves the same as
queryRenderedFeatures
with the difference that it looks for features that might be invisible. But I have never seenqueryRenderedFeatures
returning features outside of the viewport.Links to related documentation
https://docs.mapbox.com/mapbox-gl-js/api/map/#map#querysourcefeatures
The text was updated successfully, but these errors were encountered: