Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supercluster

Package Overview
Dependencies
Maintainers
29
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supercluster

A very fast geospatial point clustering library.

  • 8.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
decreased by-25.04%
Maintainers
29
Weekly downloads
 
Created

What is supercluster?

Supercluster is a fast, multi-purpose spatial clustering library for JavaScript. It is designed to handle large sets of geographical points and efficiently cluster them for visualization on maps. It is particularly useful for applications that need to display a large number of points on a map without overwhelming the user with too much information.

What are supercluster's main functionalities?

Creating a Cluster

This feature allows you to create a cluster from a set of geographical points. The code sample demonstrates how to initialize Supercluster, load points into it, and retrieve clusters for a specific zoom level and bounding box.

const Supercluster = require('supercluster');
const points = [
  { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [-73.97, 40.77] } },
  { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [-73.88, 40.78] } }
];
const index = new Supercluster({ radius: 40, maxZoom: 16 });
index.load(points);
const clusters = index.getClusters([-180, -85, 180, 85], 2);
console.log(clusters);

Getting Cluster Expansion Zoom

This feature allows you to get the zoom level at which a cluster expands into its constituent points. The code sample demonstrates how to initialize Supercluster, load points into it, and retrieve the expansion zoom level for a specific cluster.

const Supercluster = require('supercluster');
const points = [
  { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [-73.97, 40.77] } },
  { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [-73.88, 40.78] } }
];
const index = new Supercluster({ radius: 40, maxZoom: 16 });
index.load(points);
const zoom = index.getClusterExpansionZoom(1);
console.log(zoom);

Other packages similar to supercluster

Keywords

FAQs

Package last updated on 26 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc