With the save strategy I am posting the geojson to a php script where it is merged and reloaded when the map is loaded.
How do I add properties attributes to the geojson that is posted? Like a label,color, comment etc.
Posted GeoJson:
{"type" : "FeatureCollection",
"features" : [{"type":"Feature",
"properties" : {"attr_a":"TEST PROPERTY"},
"geometry" : {
"type" : "Point",
"coordinates" : [-4.1808968764,49.2150111528]
}
}]
}
Code snippet....
var saveStrategy = new OpenLayers.Strategy.Save();
saveStrategy.events.on({
'success': function(event) {
alert('Changes saved!');
},
'fail': function(event) {
alert('Error! Changes not saved');
},
scope: this
});
vlayer = new OpenLayers.Layer.Vector( "Editable" , {
style: { externalGraphic: 'red-pin.png', graphicWidth: 21, graphicHeight: 25, graphicYOffset: -24 },
projection: wgs84,
strategies: [ new OpenLayers.Strategy.Fixed(), saveStrategy],
protocol: new OpenLayers.Protocol.HTTP({url: "./run.php", format: new OpenLayers.Format.GeoJSON({ignoreExtraDims: true }) })
});