Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var drawnItems = new L.FeatureGroup();
map.addLayer(drawnItems);
$.getJSON("js/draw/neighborhoods.json",function(hoodData){
alert("this is editableLayers");
var i = 0;
var geojsonlayer = L.geoJson(hoodData,
{
// onEachFeature: function onEachFeature(feature, layer) {
// drawnItems.addLayer(layer);
// alert("this is Layers");
// }
onEachFeature: function (feature, layer) {
alert(feature.properties.prop0);
var myLayer = layer;
drawnItems.addLayer(myLayer);
// myLayer.bindPopup('<b>STATUS:</b>');
// return myLayer;
}
});
map.addLayer(drawnItems);
});
//draw controll
var drawControl = new L.Control.Draw({
draw: false,
edit: {
featureGroup: drawnItems,
remove: false,
edit: true
}
});
map.addControl(drawControl);
map.on('draw:edited', function (e) {
var layers = e.layers;
layers.eachLayer(function (layer) {
console.log(layer)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.