My Question is exactly the same as mentioned in this Question

The main difference is that I can't use bringToFront() because I have points inside the highlighted polygon that I want to show a tooltip on hover.

So I want the polygon feature just to be the uppermost, in his feature layer. Something like bringToFront() for within the layer only.

enter image description here

  • You can still achieve what you want with bringToFront() method, but with some additional work. First bring polygon to front and then with the help of Turf.js library (turfjs.org) find all the points that are within polygon and bring them to front.
    – TomazicM
    Jul 3 '19 at 19:59
  • 1
  • @TomazicM thanks for the suggestion, since I don't have that many points I just brought all of them to the front that solved it for me.
    – bmblby
    Jul 4 '19 at 11:18

For other people to know.

Since I had only a few Points in other layers.
I first brought my highlighted district to front and then all other pointer layers so mouseover event could be fired from the points again.

This restored the original order of all layers and changed the hovered district to be on top of all other districts from the corresponding layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.