Skip to content

Instantly share code, notes, and snippets.

@maptastik
Last active January 22, 2019 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maptastik/20bc285c329576bc8db188d230ed1b22 to your computer and use it in GitHub Desktop.
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
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