Dragons ahead! Accessing rendered geometries through the DOM is not part of the API. What do you want to do with the geometry?
Andreas. On Nov 3, 2011 9:51 PM, "Puneet Kishor" <[email protected]> wrote: > 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_______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users >
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
