1

I have created an application with OpenLayers 4.1.0 that imports GeoJSON vector data, allows selecting of polygons, changes "processed" property value of selected polygon from 0 to 1 and prepares edited data for export.

Code is here: https://github.com/mleontenko/openlayers-edit-properties/blob/master/map.html

Now, I'm trying to rewrite that application in OL 2.13.1: https://github.com/mleontenko/openlayers2-edit-properties/blob/master/map.html

This is the part i can't figure out how to rewrite in OL2:

//change "processed" property value from 0 to 1
select.getFeatures().item(0).set('processed', 1);

//store geojson to variable for export 
var writer = new ol.format.GeoJSON();
var geojsonStr = writer.writeFeatures(vectorSource.getFeatures());enter code here

What it needs to do is:

-Change selected polygon's "processed" property from 0 to 1

-store GeoJson to variable as string so i can export it later

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.