Declustering Markers in Google Maps with Drupal?

Location MarkerI recently received a question from a friend who's setting up a new site in Drupal 7, and is using the GMap Module, Location, and Views, to set up a map of upcoming events for his website.

My response (posted below) basically gives some pointers for what other people (often creating custom implementations of Google Maps on their sites) are doing to avoid the problem of 'decluttering' or 'declustering' multiple points at the same location (same coordinates). My question is: how do you handle declustering on your Drupal site? Are there any perferred techniques? Luckily for me, this is a problem I have yet to encounter, as I've only had to map locations of stores, parishes, etc., that are already spread out evenly over some area of a map :-)

My response to his question follows:

With regard to your question about making a map more usable when there are multiple markers on one specific geolocation (same latitude and longitude):

I know that there's one thing that the Mapstraction module does, called 'declutter points', that might be able to help. I've also found some good hints when looking up clustering and Google Maps on Google search.

But, this is definitely not an easy problem to solve. On the iPhone, if there are two markers with the same lat/lon values, I can tap on the same marker multiple times, and each time it will cycle through to the next marker underneath... also, the more markers I place in the same location, the darker the shadow beneath the marker. This is not entirely intiutive, but at least it doesn't completely hide secondary markers that are on top of each other.

However, there's also a few other issues I found online that might be helpful for you:

If you can't find what you're looking for in one of the Drupal modules you're using, I would highly suggest posting an issue to the issue queue requesting options for declustering/decluttering.

Comments

I've been working on decluttering / declustering in OpenLayers. This is a hard problem. My current solution uses the force directed graph algorithm, but calculating the extent and shape of markers is *tricky* in OL.

GMap has great integration with a number of clustering algorithms. I'm using it for our Study Abroad Programs Map, where most of our locations are spread out, in one location (Paris) we have over a dozen programs. Using Clusterer and a little custom code, I was able to wrangle the clusters nicely.

Except the question is about "de-clustering" which requires a whole different (and much more mathematically complex) set of algorithms. The best I've found for handling an n > 2 body problem is the force-directed graph algorithm, but implementing that sucker against OpenLayers is nigh impossible because collision/overlaps are extremely hard to determine based on how it draws features (and the inconsistent API between renderers...)