Server Side Google Markers Clustering - Python/Django

By : Franek

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).

Are there any examples of clustering the coordinates on the server side - preferably in Python/Django?

The way I would like this to work is to gradually index the markers based on their proximity (radius) and zoom level.

In another words when a new user registers he/she is automatically assigned to a certain 'group' of markers that are close to each other thus increasing the 'group's' counter. What's being send to the server is just a small number of 'groups'. Only when the zoom level/scale of map is 1:1 - actual users are shown on the map.

That way the client side will have to deal only with 10-50 markers per request/zoom level.

By : Franek


You can try my server-side clustering django app:

It prvides a kmeans and a grid cluster.

By : biodiv

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.

By : Evgeny

I wrote a blog post about my approach using Python and Django here:

This video can help you solving your question :)
By: admin