Skip to content

A crazy fast geospatial point clustering library for browsers and Node.

License

Notifications You must be signed in to change notification settings

femski/supercluster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

supercluster Simply Awesome Build Status

A very fast JavaScript library for geospatial point clustering for browsers and Node. A work in progress.

<script src="https://unpkg.com/[email protected]/dist/supercluster.min.js"></script>
var index = supercluster({
    radius: 40,
    maxZoom: 16
});
index.load(points);
index.getClusters([-180, -85, 180, 85], 2);

Clustering 6 million points in Leaflet:

clusters2

Methods

  • load(points) : this

Loads an array of GeoJSON.Feature objects. Each feature's geometry must be a GeoJSON.Point. Once loaded, index is immutable.

For the given bbox array ([westLng, southLat, eastLng, northLat]) and integer zoom, returns an array of clusters as GeoJSON.Feature objects.

Options

Option Default Description
minZoom 0 Minimum zoom level at which clusters are generated.
maxZoom 16 Maximum zoom level at which clusters are generated.
radius 40 Cluster radius, in pixels.
extent 512 (Tiles) Tile extent. Radius is calculated relative to this value.
nodeSize 64 Size of the KD-tree leaf node. Affects performance.
log false Whether timing info should be logged.

About

A crazy fast geospatial point clustering library for browsers and Node.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 89.4%
  • CSS 5.9%
  • HTML 4.7%