Server Side Google Markers Clustering - Python/Django

前端 未结 5 1091
一整个雨季
一整个雨季 2021-02-06 09:18

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+ user

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-06 09:32

    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

提交回复
热议问题