2.2.2 • Published 7 years ago

@pandell/supercluster v2.2.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

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/supercluster@2.2.0/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

OptionDefaultDescription
minZoom0Minimum zoom level at which clusters are generated.
maxZoom16Maximum zoom level at which clusters are generated.
radius40Cluster radius, in pixels.
extent512(Tiles) Tile extent. Radius is calculated relative to this value.
nodeSize64Size of the KD-tree leaf node. Affects performance.
logfalseWhether timing info should be logged.
selectornullFunction that selects properties from features
aggregatornullFunction to aggregate selected properties