..let me try it... mylayer.removeFeatures(mylayer.getFeatureById("start"))<div><br></div><div>uuh yes its works! </div><div><br></div><div>thank you !</div><div><br></div><div>regards</div><div>mehmet sirin c.</div>
<div><br></div><div><br></div><div><div class="gmail_quote">2009/11/26 Ivan Grcic <span dir="ltr"><<a href="mailto:igrcic@gmail.com">igrcic@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
mylayer.removeFeatures(mylayer.getFeatureById(<a href="http://startpoint.id" target="_blank">startpoint.id</a>))<br>
<br>
Andreas, I think that array param is not necessary, single feature<br>
should also work<br>
<br>
* APIMethod: removeFeatures line 581:<br>
if (!(features instanceof Array)) {<br>
features = [features];<br>
}<br>
<br>
BTW features automatically get id, so I wouldnt asign IDs manually.<br>
<br>
Cheers<br>
<div><div></div><div class="h5"><br>
On Thu, Nov 26, 2009 at 8:40 AM, Andreas Hocevar <<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>> wrote:<br>
> Hi,<br>
><br>
> Mehmet Sirin wrote:<br>
>> I'm failing when trying to remove a feature selected by its ID:<br>
>><br>
>> var startpoint= new OpenLayers.Feature.Vector(point,null,start_style);<br>
>> <a href="http://startpoint.id" target="_blank">startpoint.id</a> <<a href="http://startpoint.id" target="_blank">http://startpoint.id</a>>="hey";<br>
>> mylayer.addFeatures([startpoint]);<br>
>> ...<br>
>> var something=getFeatureById("hey"); //works<br>
>> mylayer.removeFeatures(mylayer.features[something]);<br>
><br>
> The removeFeatures method takes an array of features as argument:<br>
><br>
> myLayer.removeFeatures([something]);<br>
><br>
> Regards,<br>
> Andreas.<br>
><br>
>><br>
>><br>
>><br>
>> Maybe it's in general not possible choosing a feature by an<br>
>> associative key ?<br>
>> Then how solving this problem in another, elegant way ? (i have a<br>
>> solution for my problem, but it's definitely not fine or elegant^^)<br>
>><br>
>><br>
>><br>
>><br>
>> leaving you kind regards<br>
>> mehmet sirin c.<br>
>><br>
>><br>
>><br>
>> ------------------------------------------------------------------------<br>
>><br>
>> _______________________________________________<br>
>> Users mailing list<br>
>> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
>> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
>><br>
><br>
><br>
> --<br>
> Andreas Hocevar<br>
> OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
> Expert service straight from the developers.<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
><br>
<br>
<br>
<br>
--<br>
</div></div><font color="#888888">Ivan Grcic<br>
</font></blockquote></div><br></div>