Get rendered features / features in viewport #887
Answered
by
KiwiKilian
MarkusWendorf
asked this question in
Q&A
-
|
Hey is there a simpler way to get all features currently visible on screen? I have a working version that seems overly complicated: const visibleBounds = await map.getVisibleBounds()
const topRight = await map.getPointInView(visibleBounds[0])
const bottomLeft = await map.getPointInView(visibleBounds[1])
if (topRight && bottomLeft) {
const { features } = await map.queryRenderedFeaturesInRect(
[topRight[1], topRight[0], bottomLeft[1], bottomLeft[0]],
undefined,
['marker-layer', 'active-marker-layer', 'cluster-circle-layer', 'cluster-text-layer']
)
}I must be missing something. I think on the web it's just |
Beta Was this translation helpful? Give feedback.
Answered by
KiwiKilian
Jun 23, 2025
Replies: 1 comment 1 reply
-
|
I think this is the proper approach right now, but this could definitely be improved. Would love to align those APIs with the web variant. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
KiwiKilian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is the proper approach right now, but this could definitely be improved. Would love to align those APIs with the web variant.