I've been looking into a number of ways to display a large number of markers on a map recently, and thought that Google must have a very efficient solution to this problem (beyond having massive servers!). If you type, say, 'accommodation' into the map search bar, the map shows about 100 or so points (regardless of zoom level), and more points appear when you zoom in on a certain region. However, there must be millions of points that fall under the 'accommodation' search label, so considerable selection of markers is occurring.
I'm guessing they must use a getBounds approach to filter the markers when the user zooms in/moves about, then perhaps a random selection from those markers. However, that sounds potentially inefficient as the entire database has to be trawled to pick only those points that fall inside the map bounds. Is it simply having enormous computing power that makes Google Maps so fast (most of the time...)? Or is there a more efficient way to do this type of database querying other than the approach detailed above?
I'm building a Rails/Google Maps app that I would like to be able to scale to more than a million points - I definitely don't want to display all the points at once, but I would like to develop a fast search algorithm that isn't hugely taxing on the server to allow a (relatively small) selection of points to be rendered on the map at any one time, in a similar manner to how Google do it. Any suggestions would be most appreciated!