OPENLAYERS Add/Save new feature into existing GeoJson file

by Edgar Rodriguez   Last Updated April 16, 2018 07:22 AM

I have one point that I found geocoding api and I can create vertor layer with the point. but I cant add to my exiting GeoJson file and I need to save this new point into a existing GeoJson file like new feature point. But I cant found the correct way. Please can you give me some suggestions of How I can to add/save one new feature point into a existing GeoJson file??? I try with Writefeaute and Addfeature but nothing happen.

Thank you.

part of my code:

// VCoord = Lat and Log result of geocodingAPI.
// Add point // var point_feature = new ol.Feature({}); var point_geom = new ol.geom.Point(ol.proj.transform(vCoord, 'EPSG:4326', 'EPSG:3857')); point_feature.setGeometry(point_geom);

var vector_layer = new ol.layer.Vector({ source: new ol.source.Vector({ features: [point_feature] }), style: new{ image: new{ anchor: [0.5, 0.9], src: iconpng })), text: new{ font: '13px Calibri,sans-serif', fill: new{ color: '#ffffff' }), stroke: new{ color: '#000000', width: 2 }), text: vformatted[0], // Formated Address like Label// offsetY: 15 }) }) }); map.addLayer(vector_layer);

      var vectorIncident = new ol.layer.Vector({
            source: new ol.source.Vector({
              url: "geo_json/Incidents.geojson",
              format: new ol.format.GeoJSON()
            style:  new{
                    image: new{
                    anchor: [0.5, 0.9],
                    src: 'symbols/police.png'


     //write the new point into the existing GeoJson

Related Questions

Reprojecting vector layer from EPSG 3857 to 4326?

Updated January 01, 2019 06:22 AM

show all features in popup using openlayers 2

Updated September 23, 2017 05:22 AM

Missing files in HEC-RAS 5.0.3

Updated February 11, 2017 13:51 PM

Save as .csv with SEMICOLON separator by default

Updated April 19, 2017 16:22 PM