[OpenLayers-Users] id of polygon feature created on a vector layer
Puneet Kishor
punk.kish at gmail.com
Thu Nov 3 16:51:10 EDT 2011
I have code like so
var sLyr = new OpenLayers.Layer.Vector("s");
map.addLayers([sLyr]);
var polyCtrl = new OpenLayers.Control.DrawFeature(
sLyr,
OpenLayers.Handler.Polygon,
{featureAdded: foo}
);
function foo(evt){
var elem = document.getElementById(evt.feature.geometry.id);
// do something with elem
}
map.addControl(polyCtrl);
polyCtrl.activate();
I get an error: "TypeError: 'undefined' is not an object (evaluating 'evt.feature.geometry')"
So, foo() is getting fired alright. What is my error above, and how do I solve it? Essentially, I want to access the id of the polygon just created.
--
Puneet Kishor
More information about the Users
mailing list