Most efficient way to get visible markers on a map?

Viewed 199

I've got a map with tens/hundreds of thousands of markers on it, currently stored in array (docs for Marker Class). I need to find markers that are within current map bounds.

The most obvious way is to loop through the entire array and check if map bounds contain marker, but that is not an efficient way to do it.

What data structure and/or algorithm can help to solve the problem?

1 Answers
Related