JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3205445
  • Score
    100M100P100Q201671F
  • License ISC

A crazy fast geospatial point clustering library.

Package Exports

  • supercluster
  • supercluster/dist/supercluster

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (supercluster) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

supercluster Simply Awesome Build Status

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

<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

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.

Developing Supercluster

npm install       # install dependencies
npm run build-dev # generate dist/supercluster.js
npm run build-min # generate dist/supercluster.min.js
npm test          # run tests