Brilliant!  Thanks Esteban!

                function deleteMarkers() {
                        var i=0;
                        var myMarkers = markerLayer.markers;
                        while (i<myMarkers.length) {
                                var myMarker = myMarkers[i];
                                if (myMarker.lonlat.lat == 45) {
                                        markerLayer.removeMarker(myMarker);
                                } else {
                                        i=i+1;
                                }
                        }
                                        }



On Sun, Mar 16, 2008 at 5:32 PM, Esteban olm <[EMAIL PROTECTED]> wrote:
> Linda, Your code is weong. You need a WHILE, not a FOR
>
> Your List: 0, 30, 45, 45, 45, 45, 30
>
> An example of iteration in your list:
>
> i=0, List[i]=0  <- don't do anithig
> Your List: 0, 30, 45, 45, 45, 45, 30
>
> i=1, List[i]=30  <- don't do anithig
> Your List: 0, 30, 45, 45, 45, 45, 30
>
> i=2, List[i]=45  <- delete
> Your List: 0, 30, 45, 45, 45, 30
>
> i=3, List[i]=45  <- delete
> Your List: 0, 30, 45, 45, 45, 30
>
> i=4, List[i]=45  <- delete
> Your List: 0, 30, 45, 45, 30
>
> i=5, <- end, out of list
> Total: 3 deletes.
>
> Use a  while and an i variable
> i++ when nothing happens
> i no change when delete
>
> 2008/3/16, Eric Lemoine <[EMAIL PROTECTED]>:
> >
> >
> >
> > On Sun, Mar 16, 2008 at 6:26 PM, Linda Rawson <[EMAIL PROTECTED]>
> wrote:
> > > I have to cycle through the marker layer again and again until all the
> > >  markers are gone.  What a performance hit!
> >
> >
> > What wouldn't you follow Huub's recommandation?
> > --
> >
> > Eric
> >
> > _______________________________________________
> > Users mailing list
> > [email protected]
> > http://openlayers.org/mailman/listinfo/users
> >
>
>



-- 
Linda Rawson
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to