Skip to content Skip to sidebar Skip to footer

Server Side Google Markers Clustering - Python/django

After experimenting with client side approach to clustering large numbers of Google markers I decided that it won't be possible for my project (social network with 28,000+ users).

Solution 1:

This is a paid service that uses server-side clustering, but I'm not sure how it works. I'm guessing that they just use your data to generate the markers to be shown at each zoom level.

Update:This tutorial demonstrates a basic server-side clustering function. It's written in PHP for the Static Maps API, but you could use it as a starting point.

Solution 2:

You might want to take a look at the DBSCAN and OPTICS pages on wikipedia, these looks very suitable for clustering places on a map. There is also a page about Cluster Analysis that shows all the possible algorithms you can use, most would be trivial to implement using the language of your choice.

With 28k+ points, you might want to skip django and just jump into C/C++ directly, and surely not expect this to get calculated in real-time in response to web requests.

Solution 3:

One way to do it would be to define a grid with a unit size based on the zoom level. So you collect up all the items within a grid by lat,lon to one decimal place. An example is 42.2x73.4. So a point at 42.2003x73.4021 falls in that grid cell. That cell is bounded by 42.2x73.3 and 42.2x73.5.

If there are one or more points in a grid cell, you place a marker in the center of that grid.

You then hook up the zoomend event and change your grid size accordingly, and redraw the markers.

http://code.google.com/apis/maps/documentation/reference.html#GMap2.zoomend

Solution 4:

You can try my server-side clustering django app:

https://github.com/biodiv/anycluster

It prvides a kmeans and a grid cluster.

Post a Comment for "Server Side Google Markers Clustering - Python/django"