This is the mysql version of https://github.com/biodiv/anycluster/
It differs from the postgis version. Currently, only centroid clustering is supported and there is no support for filters yet.
anycluster provides Server-Side clustering of map markers for Geodjango. It is suitable for large amounts of markers. Depending on your server and personal feeling, it works very well with 200.000 to 500.000 markers.
- python 2.7 (3.x not supported)
- Django 1.6
- GeoDjango
- MySQL 5.0+
- a spatial column holding your point coordinates
- a spatial index on that column
-
unzip the folder anycluster into your project directory
-
add ‘anycluster’ to your INSTALLED_APPS
-
required SETTINGS (settings.py)
ANYCLUSTER_GEODJANGO_MODEL = "yourapp.your_geodjango_model"
ANYCLUSTER_COORDINATES_COLUMN = "your_geometric_column"
-
add the following to your STATICFILES_DIRS (settings.py)
'/PATH_TO_YOUR_PROJECT_FOLDER/anycluster/static'
-
urls.py
url(r'anycluster/', include('anycluster.urls')),
Load the required modules
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOURKEY&sensor=false"></script>
<script type="text/javascript" src="{% static 'anycluster/anycluster.js' %}"></script>
<script type="text/javascript" src="{% static 'anycluster/django_ajax_csrf.js' %}"></script>
<script type="text/javascript" src="{% static 'anycluster/anycluster_marker.js' %}"></script>
<link rel="stylesheet" href="{% static 'anycluster/anycluster.css' %}">
Start clustering
var anyclusterSettings = {
mapType : "google",
gridSize: 64, //integer
zoom: 3, //initial zoom
center: [10,11], //initial center in lng lat
MapTypeId: "TERRAIN", //ROADMAP,SATELLITE,HYBRID or TERRAIN
clusterMethod : "centroid", //currently only centroid is supported
iconType: "exact",
onFinalClick : function(entries){
//do something with the html(entries)
}
}
window.onload = function(){
anycluster = new Anycluster("div_id", anyclusterSettings);
}