Eeyore
Eeyore

Reputation: 2126

How to use R-Tree for plotting large number of map markers on google maps

After searching SO and multiple articles I haven't found a solution to my problem.

What I am trying to achieve is to load 20,000 markers on Google Maps.

R-Tree seems like a good approach but it's only helpful when searching for points within the visible part of the map. When the map is zoomed out it will return all of the points and...crash the browser.

There is also the problem with dragging the map and at the end of dragging re-running the query.

I would like to know how I can use R-Tree and be able to achieve the all of the above.

Upvotes: 1

Views: 1525

Answers (2)

Paulus
Paulus

Reputation: 1457

If you don't want to bother with clustering, then just terminate your marker list at a preset number, maybe a few hundred (which you can determine by usability testing), and display some indication that there are more available as you zoom in

Upvotes: 0

tcarobruce
tcarobruce

Reputation: 3838

As noted, R-Tree won't help you when you're looking at a zoomed-out view. This problem is often addressed by marker clustering, because showing 20,000 points in a browser window isn't that useful.

Marker Manager is an open source javascript library which addresses this, but there are others.

With a very great number of markers, you may need to look at server-side clustering, (where R-Tree may come in handy!). Here is one discussion of it, and its google cache because link is dead at time of writing.

Upvotes: 2

Related Questions