OpenLayers – Accessing Feature using `featureadded` Event.
We might need to alter a feature or to extract a particular attributes upon feature added to the layer. So we need to register an event named `featureadded` for the target layer.
function newVectorLayer(name, option) { var n = new OpenLayers.Layer.Vector(name, option); n.events.register('featureadded', null, function (e) { // do something } ); return n; }
p/s: use `featuresadded` if you need to access when all features are added.