You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though the docs say that the rectangle is "A rectangle expressed in the map view’s coordinate system." I've figured through trial and error that it's actually supposed to be based on screen coordinates.
However I cannot figure out why my code is not working as expected. It appears misaligned.
<MapView
ref={mapViewRef}
onPress={async (event) => {
const [x, y] = [event.properties.screenPointX, event.properties.screenPointY]
// works as expected: returns the features at the point
console.log(await mapViewRef.current?.queryRenderedFeaturesAtPoint([x, y]))
// does not work as expected: returns the features somewhat offset from the point
console.log(await mapViewRef.current?.queryRenderedFeaturesInRect([x, y, x, y]))
}
/>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Even though the docs say that the rectangle is "A rectangle expressed in the map view’s coordinate system." I've figured through trial and error that it's actually supposed to be based on screen coordinates.
However I cannot figure out why my code is not working as expected. It appears misaligned.
Beta Was this translation helpful? Give feedback.
All reactions