Skip to content
Discussion options

You must be logged in to vote

I feel the best way to accomplish this might depend on the map's data/style.

For instance, in https://demotiles.maplibre.org/style.json used above, there is no explicit style layer for water — note how the water's colour #D8F2FF comes from the style layer with ID background. (It does not come from crimea-fill; you can play around with the style at https://maputnik.github.io/editor/?style=https://demotiles.maplibre.org/style.json to confirm this.)
This means that when passing the click event coords to Map.queryRenderedFeatures, it will:

  • not return any feature if the click was on bare water, since you are essentially clicking on an area with no associated data (hence @HarelM's solution abo…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@LamprosPitsillos
Comment options

@HarelM
Comment options

@sruenwg
Comment options

Answer selected by LamprosPitsillos
@LamprosPitsillos
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants