Skip to content

Instantly share code, notes, and snippets.

@brunodbo
Created November 24, 2013 01:07
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 brunodbo/7622091 to your computer and use it in GitHub Desktop.
Save brunodbo/7622091 to your computer and use it in GitHub Desktop.
Leaflet onEachFeature() function to show polygon coordinates in a popup. Useful for cleaning a up geodata file.
function onEachFeature(feature, layer) {
var coordinates = feature.geometry.coordinates[0];
var coordinatesString = '';
$.each(coordinates, function(key, value) {
coordinatesString = coordinatesString + '[' + value + ']';
});
var popup = L.popup().setContent(coordinatesString);
layer.bindPopup(popup);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment