how can i get the coordinates value on drawing of polygon at each mouse click , actually i want to store each coordinates i clicked during vector drawing.<br><br> currently i use this for vector drawing controls but at time of drawing i cannot get the coordinates at each point i clicked during drawing.<br>
<br> controls = {<br> point: new OpenLayers.Control.DrawFeature(vectors,<br> OpenLayers.Handler.Point),<br> line: new OpenLayers.Control.DrawFeature(vectors,<br> OpenLayers.Handler.Path),<br>
polygon: new OpenLayers.Control.DrawFeature(vectors,<br> OpenLayers.Handler.Polygon),<br> drag: new OpenLayers.Control.DragFeature(vectors),<br> select: select,<br> regular: new OpenLayers.Control.DrawFeature(vectors,<br>
OpenLayers.Handler.RegularPolygon,<br> { handlerOptions: { sides: 5} }),<br> modify: new OpenLayers.Control.ModifyFeature(vectors)<br> };<br><br> for (var key in controls) {<br>
map.addControl(controls[key]);<br> }<br><br>and for reading mouse i use : <br> map.addControl(new OpenLayers.Control.MousePosition({element:document.getElementById("longlats"), numdigits:3}));<br><br>
if it is in navigation only mode i can read and store mouse click as :<br>OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {<br> defaultHandlerOptions: {<br> 'single': true,<br> 'pixelTolerance': 0 //, // 'stopSingle': false <br>
},<br> initialize: function(options) {<br> this.handlerOptions = OpenLayers.Util.extend(<br> {}, this.defaultHandlerOptions<br> );<br> OpenLayers.Control.prototype.initialize.apply(<br>
this, arguments<br> );<br> this.handler = new OpenLayers.Handler.Click(<br> this, { 'click': this.trigger }, this.handlerOptions<br> );<br>
},<br> trigger: function(e) {<br> var lonlat = map.getLonLatFromViewPortPx(e.xy);<br> var pos = "Longitude: " + lonlat.lon + " E, <br/>Latitude: " + lonlat.lat + "N"; // alert("You clicked near " + lonlat.lat + " N, " +lonlat.lon + " E");//OpenLayers.Util.getElement("longval").innerHTML = pos;<br>
document.data1.longval.value = lonlat.lon;<br> document.data1.latval.value = lonlat.lat;<br><br>but i don't got idea how can i combine these all to function together while drawing vector point, line and polygon<br>
<br><br>/nabin,<br>