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.24k stars 2.23k forks source link

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

Open joedjc opened 1 month ago

joedjc commented 1 month ago

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:

Design Alternatives

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.