<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px">
<DIV>I have found a similar problem to Adorian using OL2.7. When I click on the feature to delete it, the polygon disappears, but not the vertices. In the code below, crops is a Vector polygon layer loaded from a geoJSON file:</DIV>
<DIV>&nbsp;</DIV>
<DIV>var delf = &nbsp;new OpenLayers.Control.SelectFeature(crops, {onSelect: function(feature) {crops.destroyFeatures([feature])}});</DIV>
<DIV>map.addControl(delf);</DIV>
<DIV>delf.activate();</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert Sanson<BR><BR>&gt;&gt;&gt; Tim Schaub &lt;tschaub@opengeo.org&gt; 5/08/2008 12:13 a.m. &gt;&gt;&gt;<BR>Hey-<BR><BR>Adorian Ardelean wrote:<BR>&gt; Hi,<BR>&gt; <BR>&gt; After upgrading to OL 2.6, delete feature function does not work correctly:<BR>&gt; when a polygon or polyline is removed, the lines that define the <BR>&gt; disappear, but the vertexes not (the vertexes appear as the entity is <BR>&gt; selected). The code worked flawlessly in previous version. Is something <BR>&gt; that I have to be aware and/or modify?<BR>&gt; <BR>&gt; declaration of control<BR>&gt; deletefeature: new <BR>&gt; OpenLayers.Control.SelectFeature(vectors,{onSelect:deleteFeature})<BR>&gt; <BR>&gt; delete function<BR>&gt; function deleteFeature(geometry)<BR>&gt; {<BR>&gt;&nbsp;&nbsp; this.layer.removeFeatures(geometry);<BR>&gt; }<BR>&gt; <BR>&gt; Any hint that may solve this issue is appreciated,<BR><BR>I just tried the following and confirmed that the above works.<BR><BR>1) open <A href="http://openlayers.org/dev/examples/draw">http://openlayers.org/dev/examples/draw</A>-feature.html<BR>2) draw a polygon (note freehand is true here)<BR>3) in the firebug console, run this code:<BR><BR>var del = new OpenLayers.Control.SelectFeature(<BR>&nbsp;&nbsp;&nbsp;&nbsp; map.layers[3], {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onSelect: function(feature) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.layers[3].removeFeatures([feature]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>);<BR>map.addControl(del);<BR>del.activate();<BR><BR>4) click on your polygon to see it removed<BR><BR>I suspect you really want to be calling destroyFeatures instead of <BR>removeFeatures - unless you call feature.destroy elsewhere.<BR><BR>Tim<BR><BR>&gt; Adorian<BR>&gt; <BR>&gt; -- <BR>&gt; Dr. Adorian Ardelean<BR>&gt; coordinator of myNature Project<BR>&gt; <BR>&gt; proiectul myNature<BR>&gt; str. Rascoala din 1907 nr 12<BR>&gt; Timisoara 300523<BR>&gt; Romania<BR>&gt; <BR>&gt; <A href="http://mybiosis.info/nature/portal.php?pagename=firstpage">http://mybiosis.info/nature/portal.php?pagename=firstpage</A> [a Romanian <BR>&gt; biodiversity-database]<BR>&gt; <A href="http://mybiosis.info/nature/portal.php?pagename=adorian">http://mybiosis.info/nature/portal.php?pagename=adorian</A> [CV]<BR>&gt; <BR>&gt; <BR>&gt; ------------------------------------------------------------------------<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; Users mailing list<BR>&gt; Users@openlayers.org<BR>&gt; <A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR><BR>_______________________________________________<BR>Users mailing list<BR>Users@openlayers.org<BR><A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR><BR></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The&nbsp;contents&nbsp;of&nbsp;this&nbsp;email&nbsp;are&nbsp;confidential&nbsp;to&nbsp;AsureQuality.&nbsp;If&nbsp;you&nbsp;have&nbsp;received&nbsp;this&nbsp;communication&nbsp;in&nbsp;error&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;delete&nbsp;the&nbsp;message&nbsp;and&nbsp;any&nbsp;attachments.&nbsp;The&nbsp;opinions&nbsp;expressed&nbsp;in&nbsp;this&nbsp;email&nbsp;are&nbsp;not&nbsp;necessarily&nbsp;those&nbsp;of&nbsp;AsureQuality.&nbsp;This&nbsp;message&nbsp;has&nbsp;been&nbsp;scanned&nbsp;for&nbsp;known&nbsp;viruses&nbsp;before&nbsp;delivery.&nbsp;AsureQuality&nbsp;supports&nbsp;the&nbsp;Unsolicited&nbsp;Electronic&nbsp;Messages&nbsp;Act&nbsp;2007.&nbsp;If&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;receive&nbsp;similar&nbsp;communications&nbsp;in&nbsp;future,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;of&nbsp;this&nbsp;message.<br>
------------------------------------------------------------------</td></tr></table><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc.  </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>