Hello community! This is my first post; I hope I'm not asking too trivial a question. :) I'll get right into it:
Based on this example -- http://www.openlayers.org/dev/examples/drag-feature.html -- I have put a similar control on my website where I can draw a polygon on my map. So what I want to do is get the coordinates of my polygon’s vertices after I finish drawing it. According to http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Handler/Polygon-js.html there are callback functions called ‘point’ and ‘done’ that should be able to give me what I want. My question is how do I get control of those functions? I think I am a little lacking in syntax knowledge as to how to set it up. For example I have: var drawpoly = new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Polygon); map.addControl(drawpoly); which takes care of enabling the drawing feature. But I don’t know how to get to the done() callback function from here. On a separate note, I found this example online: var drawpoly = new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Polygon, {'featureAdded': polygonAdded}); ... polygonAdded = function (feature) { //Yay, I can do stuff here! } which is pretty close to what I want, but I think the object passed to it is not the polygon object I want to manipulate. (Or is it?) If anyone has a better way to get the coordinates of a polygon (I assume I'd get an x-y pixel value first and would have to convert to lat/lng), I'd love to hear that, too. But knowing how to get to the callbacks would also be useful in future applications. :) Thanks for reading and considering! --Harry [email protected]
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
