Loop the array of markers and check map.getBounds().contains(marker.getLatLng())
-- Marcelo - http://maps.forum.nu -- On Oct 16, 12:43 pm, Lluís <[EMAIL PROTECTED]> wrote: > Hello, > > I'm developing a mashup using Google Maps, we have thousands of > markers inside. One thing I would like to do is at the end of the > movement of the map (moveend event) to list the markers in the > viewport in a list element. > > Nowadays, I have a function in the moveend event for the marker, and > for each marker that is contained by the viewport I append a new > element in the list. This approach it's a bit slow, so with 1000 > markers, i have to enter 1000 times in this function. > > I want to change my approach, and I'm thinking in: > > 1. Get just the markers in the viewport > 2. Add it to the list. > > In this way, if the 1st function is fast, we work just for few markers > instead of 1000. > > The 1st point is where I have doubts, so: Is there any function that > gives me the current markers inside the viewport? This functions loops > for all the markers or it makes any optimization? > > Thank you very much, > > Lluís --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
