hi, ross. its not working properly....it always delete wrong ones...if
i do hide and show...i think it will wrk in same way. ross we are
going to be use 5000 marker all over UK....do u think this will be
good way to do or is there ant other perfect way...i used
markerManager it taking care automatically but becoming very
slow....do u know any other option and also fast...?



On Jun 18, 11:36 pm, Rossko <[email protected]> wrote:
> > hi ross, i understand the array how its work....and now its removing
> > value from array as well.....but i think i m calling it in wrong
> > place. becoz its removing wrong markers....
>
> No, your doing it in the right place, and I believe its removing some
> of the right markers, BUT it's not removing all the ones you expect.
>
> My fault for suggesting this structure -
>
> > for(id in batch){
> >...
> >     if (...
> >     } else { ...
> >         batch.splice(id,1);
> >     }
> > }
>
> It's really dumb to delete items from an array while we're stepping
> through it, it messes up the for-in loop.
>
> Try this workaround
>
>   var for_deletion = [];  // a temporary store
>   for(id in batch){
>        ...
>        if (...
>        } else { ...
>             map.removeOverlay(....
>             for_deletion.push(id);     // make a note for later
> deletion
>         }
>    } // end of for-in loop
>
>    for (var i = 0; i < for_deletion.length; i++) {     // scan for the
> ones we need to bin
>    {
>         id = for_deletion[i];
>         batch.splice(id,1);   // really delete the item
>    }
>
> There's probably a much more elegant way to do this!
>
> cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to