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);

      function(evt) {
        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"));
            url: 'FloodAlert.json',
            type: 'POST',

            data: text

        }).then(function(response) {
  • this is an old question but I guess trying to answer it won't hurt. I got the same problem as I wanted to develop a web app that rely little on servers, but for storing data in files one surely needs something like PHP and AJAX to do so. – Hicham Zouarhi May 9 '16 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.