Last active
January 22, 2019 15:11
-
-
Save maptastik/20bc285c329576bc8db188d230ed1b22 to your computer and use it in GitHub Desktop.
List all of a features fields and values in a popup in Leaflet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function allFieldsPopup(feature, layer) { | |
let featureProperties = feature.properties; | |
let popupHtml = ''; | |
for(let property in featureProperties) { | |
popupHtml+=`<b>${property}:</b> ${featureProperties[property]}<br>` | |
} | |
layer.bindPopup(popupHtml) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment