iwindx / rs-supercluster

rust edition supercluster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rs-supercluster

A very fast Napi rs JavaScript extension library for geospatial point clustering of browsers and nodes.

// import as a ES module
import Supercluster from 'supercluster';

// or require in Node / Browserify
const Supercluster = require('supercluster');

const index = new Supercluster({
    radius: 40,
    maxZoom: 16
});
index.load(points);

Methods

load(points)

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

Options

Option Default Description
minZoom 0 Minimum zoom level at which clusters are generated.
maxZoom 16 Maximum zoom level at which clusters are generated.
minPoints 2 Minimum number of points to form a cluster.
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.
generateId false Whether to generate ids for input features in vector tiles.
npm run build
npm example/demo.js 

About

rust edition supercluster


Languages

Language:Rust 56.9%Language:JavaScript 43.1%