<p>Dragons ahead! Accessing rendered geometries through the DOM is not part of the API. What do you want to do with the geometry? </p>
<p>Andreas. </p>
<div class="gmail_quote">On Nov 3, 2011 9:51 PM, "Puneet Kishor" <<a href="mailto:punk.kish@gmail.com">punk.kish@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have code like so<br>
<br>
var sLyr = new OpenLayers.Layer.Vector("s");<br>
map.addLayers([sLyr]);<br>
<br>
var polyCtrl = new OpenLayers.Control.DrawFeature(<br>
sLyr,<br>
OpenLayers.Handler.Polygon,<br>
{featureAdded: foo}<br>
);<br>
<br>
function foo(evt){<br>
var elem = document.getElementById(<a href="http://evt.feature.geometry.id" target="_blank">evt.feature.geometry.id</a>);<br>
<br>
// do something with elem<br>
}<br>
<br>
map.addControl(polyCtrl);<br>
polyCtrl.activate();<br>
<br>
I get an error: "TypeError: 'undefined' is not an object (evaluating 'evt.feature.geometry')"<br>
<br>
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.<br>
<br>
<br>
--<br>
Puneet Kishor_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</blockquote></div>