Skip to content

Instantly share code, notes, and snippets.

@benheb
Created August 22, 2012 21:26
Show Gist options
  • Save benheb/3429540 to your computer and use it in GitHub Desktop.
Save benheb/3429540 to your computer and use it in GitHub Desktop.
updateFeature: function(f){
var guid = f.layer;
var f_id = f.feature;
var time = new Date();
var features = {};
features.id = f.feature;
features.geometry = f.geometry
jq('#attribute-form').children('input').each(function (i,f) {
var name = jq(this).attr('id');
var attr = jq(this).val();
features[name] = attr;
});
//update new feature
F1.Maker.current_map.updateFeatures(guid, [features]);
setTimeout(function(){
F1.Maker.current_map.deleteFeatures(guid, [features.id]);
F1.Maker.current_map.addFeatures(guid, [features], false, true);
F1.Maker.current_map.saveFeatures(guid);
},200);
jq('#attribute-form input[type="text"]').val('');
jq('#annotation-controls').hide();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment