7

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.

4

4 回答 4

2

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.

于 2009-04-30T14:57:03.023 回答
1

您可能想查看维基百科上的DBSCANOPTICS页面,这些页面看起来非常适合在地图上对地点进行聚类。还有一个关于聚类分析的页面,显示了您可以使用的所有可能的算法,使用您选择的语言来实现大多数算法都是微不足道的。

有了 28k+ 点,您可能想跳过 django 直接跳到 C/C++ 中,当然不会期望这会实时计算以响应 Web 请求。

于 2010-08-15T09:02:07.763 回答
0

一种方法是根据缩放级别定义具有单位大小的网格。因此,您将网格中的所有项目按纬度、经度收集到小数点后一位。一个例子是 42.2x73.4。所以 42.2003x73.4021 的点落在该网格单元中。该单元格以 42.2x73.3 和 42.2x73.5 为界。

如果网格单元中有一个或多个点,则在该网格的中心放置一个标记。

然后,您连接 zoomend 事件并相应地更改网格大小,然后重绘标记。

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

于 2009-04-30T12:40:04.803 回答
0

你可以试试我的服务器端集群 django 应用:

https://github.com/biodiv/anycluster

它提供了一个 kmeans 和一个网格集群。

于 2013-03-20T19:50:51.253 回答