<div>Hi Christoph,</div>
<div> </div>
<div>thank you very much for your assistance. I tried the following and it works beautifully. One little problem is the closing of the polygon vertices. Before adding the events listeners, a simple double-click will close the polygon. After adding the events, sometimes I need to double-click twice to close the polygon. Not a big problem though. Thanks again. - Albert Ang</div>

<div> </div>
<div>function report(event) {<br>                //OpenLayers.Console.log(event.type, event.feature ? <a href="http://event.feature.id">event.feature.id</a> : event.components);<br>    displayWKT(event.feature);<br> }</div>

<div> </div>
<div>aoi.events.on({<br>                &quot;beforefeaturemodified&quot;: report,<br>                &quot;featuremodified&quot;: report,<br>                &quot;afterfeaturemodified&quot;: report,<br>                &quot;vertexmodified&quot;: report,<br>
                &quot;sketchmodified&quot;: report,<br>                &quot;sketchstarted&quot;: report,<br>                &quot;sketchcomplete&quot;: report                </div>
<div>});</div>
<div> </div>
<div>function displayWKT(feature) {<br>            var str = wkt.write(feature);<br>            // not a good idea in general, just for this demo<br>            //str = str.replace(/,/g, &#39;, &#39;);<br>            document.getElementById(&#39;info&#39;).innerHTML = str;<br>
   document.aoi.vertex.value = str;<br>   <br>   var areaAOI = feature.geometry.getGeodesicArea();<br>   areaAOI = areaAOI / 1000000;<br>   var areaAOIstr = &#39;Approx. area : &#39; + areaAOI + &#39; sq. km&#39;;<br>   document.getElementById(&#39;area&#39;).innerHTML = areaAOIstr;</div>

<div>        } // end function displayWKT(feature)<br><br></div>
<div class="gmail_quote">On Fri, Feb 19, 2010 at 2:05 AM, Christoph Ratke <span dir="ltr">&lt;<a href="mailto:christoph.ratke@gmx.net" target="_blank">christoph.ratke@gmx.net</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi Mr. Ang,<br><br>you can have a look here:<br><a href="http://dev.openlayers.org/releases/OpenLayers-2.8/examples/modify-feature.html" target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.8/examples/modify-feature.html</a><br>
or here:<br><a href="http://dev.openlayers.org/releases/OpenLayers-2.8/examples/highlight-feature.html" target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.8/examples/highlight-feature.html</a><br><br>Have a good day,<br>
Christoph<br><br><br>Albert Ang schrieb:<br>
<div>
<div></div>
<div>&gt; Dear all,<br>&gt;<br>&gt; I need assistance in using the events of DrawFeature and<br>&gt; ModifyFeature. Can anyone provide some examples? I use the DrawFeature<br>&gt; and ModifyFeature as following but need guidance on how to use the<br>
&gt; events of DrawFeature (featureadded) and ModifyFeatures<br>&gt; (featuremodified). Basically I like to use the<br>&gt; feature.geometry.getGeodesicArea() function to calculate area<br>&gt; dynamically when an user draws a polygon or when he modifies the polygon.<br>
&gt;<br>&gt; controls = {<br>&gt;                 dpolygon: new OpenLayers.Control.DrawFeature(aoi,<br>&gt;                             OpenLayers.Handler.Polygon, drawOptions),<br>&gt;                 modify: new OpenLayers.Control.ModifyFeature(aoi,<br>
&gt;<br>&gt; modifyOptions),<br>&gt;               selectVector: new OpenLayers.Control.SelectFeature(aoi,<br>&gt; wktOptions)<br>&gt; }<br>&gt;<br>&gt; Thank you in advance.<br>&gt;<br>&gt; Albert<br></div></div>&gt; ------------------------------------------------------------------------<br>
&gt;<br>&gt; _______________________________________________<br>&gt; Users mailing list<br>&gt; <a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br>&gt; <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
&gt;<br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br><a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</blockquote></div><br>