Skip to content

Instantly share code, notes, and snippets.

@pavan-cs
Created June 14, 2017 15:19
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 pavan-cs/172cbb99f3611b2597165c1330544a96 to your computer and use it in GitHub Desktop.
Save pavan-cs/172cbb99f3611b2597165c1330544a96 to your computer and use it in GitHub Desktop.
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