Can i save the features on selecting points into same json file?`function addInteraction() { draw = new ol.interaction.Draw({ source: floodAlertLayer.getSource(), type: typeSelect.value }); map.addInteraction(draw);
draw.on('drawend', function(evt) { console.log(evt.feature); var parser = new ol.format.GeoJSON(); var features = floodAlertLayer.getSource().getFeatures(); var featuresGeoJSON = parser.writeFeatures(features); var text = JSON.stringify(featuresGeoJSON); // document.getElementById('info').innerHTML = text; // alert(features.get("COUNTY")); $.ajax({ url: 'FloodAlert.json', type: 'POST', data: text }).then(function(response) { console.log(response); }); }, this); }`
أكثر...
draw.on('drawend', function(evt) { console.log(evt.feature); var parser = new ol.format.GeoJSON(); var features = floodAlertLayer.getSource().getFeatures(); var featuresGeoJSON = parser.writeFeatures(features); var text = JSON.stringify(featuresGeoJSON); // document.getElementById('info').innerHTML = text; // alert(features.get("COUNTY")); $.ajax({ url: 'FloodAlert.json', type: 'POST', data: text }).then(function(response) { console.log(response); }); }, this); }`
أكثر...