Skip to content
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

Map interaction functions don't accommodate z-offset #13310

Open
joedjc opened this issue Oct 25, 2024 · 0 comments
Open

Map interaction functions don't accommodate z-offset #13310

joedjc opened this issue Oct 25, 2024 · 0 comments

Comments

@joedjc
Copy link

joedjc commented Oct 25, 2024

Motivation

I want to interact with map features which are elevated (e.g. with line-z-offset, symbol-z-offset, fill-z-offset). For example, I can highlight an elevated line when hovered or click on it to trigger an event.

Unless i'm missing something, the following functions don't account for the z-offset:

  • on click, on mouseover etc: These events only get fired if I click on the ground co-ordinates rather than the offset feature which wouldn't be intuitive for users
  • QueryRenderedFeatures: No way to query features under the mouse which might be offset from the ground though might be better solved with...
  • unproject / project: I may want to calculate the ground co-ordinates X metres below the pixel coordinates (e.g. to create geometry offset from the ground or QueryRenderedFeatures at that ground position)

Design Alternatives

  • on click/ on mouse over etc: I would expect the features which are visible at the mouse position to be returned, even if they are offset. Or perhaps this could be an optional parameter.
  • QueryRenderedFeatures: Similar to above
  • unproject / project: Add a parameter to give a value offset from the co-ordinates in a number of metres.

Suggestion

I think adding the ability to incorporate a z-offset to the unproject/project functions might be the most beneficial short term, as it could be used in combination with QueryRenderedFeatures to achieve the desired result. However, one limitation is this is only beneficial if I know the z-offset of the features I want to query in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant