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