Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet.tilecluster

Provides the cluster service by tile map, much like the plugin utfgrid and visually similar to the markercluster.

Using the plugin

Create a new TileCluster.

var cluster = new L.TileCluster('http://maps.gogeo.io/map/db1/people/{z}/{x}/{y}/cluster.json?cluster_qtd={cq}');

map.addLayer(cluster);

?callback={cb} is required when using cluster in JSONP mode.

var cluster = new L.TileCluster('http://maps.gogeo.io/map/db1/people/{z}/{x}/{y}/cluster.json?callback={cb}&cluster_qtd={cq}',
  {
    useJsonP: true
  }
);

map.addLayer(cluster);

?cluster_qtd={cq} is the amount of clusters to be created for each tile (default is 1 cluster per tile). You can use your own function based on zoom:

var cluster = new L.TileCluster('http://maps.gogeo.io/map/db1/people/{z}/{x}/{y}/cluster.json?callback={cb}&cluster_qtd={cq}',
  {
    {
      useJsonP: true,
      calculateClusterQtd: function(zoom) {
        if (zoom >= 8) {
          return 2;
        } else {
          return 1;
        }
      }
    }
  );

Live example

http://demos.gogeo.io/geo-aggregation

License

Leaflet.tilecluster is free software, and may be redistributed under the MIT-LICENSE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages