I have multiple layers, say a site location as a marker and a town location as a polygon. I want to be able to click on the marker and push it's attributes to a dialog, and also send the polygon's name attribute to the same dialog.
So I need to get both layers information from the same click. The marker is easy and in it's onEachFeature I can run an on-click function, but how do I fire off the click for the second layer by only coordinates?
End result would be a dialog with a tab for each layer, to show it's information.
Best Answer
I figured this out, in the marker onEachFeature I added an on-click, and grabbed the clicks coordinates, then I used these coordinates, passed them to a function and used TURF to check if the point coords were inside the municipal poly, if so set the name to a variable and use it to add to my bootstrap dialog. The only issue was turf points use Long, Lat instead of Leaflets lat, long.