Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 739
Franek Avatar asked Apr 30 '09 01:04

Franek


2 Answers

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.

like image 129
Chris B Avatar answered Oct 06 '22 22:10

Chris B


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.

like image 22
Evgeny Avatar answered Oct 06 '22 23:10

Evgeny