0

I have created two feature-collection(polygon , multi polygon) layers and applied the on click event on both of them. layer2(which is above the layer1) is completely covering the area of layer1. So when i click on the layer2 , the respective click event is coming under action. And the click event of layer1 is not coming under action. what i want is that when i click on any layer , click event of both the layers should be triggered.

  layer1 = L.geoJSON(data2,{
                    onEachFeature: onEachFeature
                }).addTo(map);
                layer2 = L.geoJSON(data1,{
                    onEachFeature: onEachFeature2
                }).addTo(map);

                var overlays = {
                    "layer one": layer1,
                    "layer two": layer2
                };

roshan
  • 1

1 Answers1

0

A way would be to listen on the map for the click event:

map.on('click',(e)=>console.log(e))
Falke Design
  • 10,635
  • 3
  • 15
  • 30