Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
marker-cluster
Advanced tools
Library for point clustering
import MarkerCluster from "marker-cluster";
type Point = { lat: number; lng: number };
const points: Point[] = [
{ lat: -31.56391, lng: 147.154312 },
{ lat: -33.718234, lng: 150.363181 },
{ lat: -33.727111, lng: 150.371124 },
{ lat: -33.848588, lng: 151.209834 },
];
const markerCluster = new MarkerCluster<Point>((v) => [v.lng, v.lat], {
radius: 75,
});
markerCluster.load(points);
// or
await markerCluster.loadAsync(points);
const currPoints = markerCluster.getPoints(
2,
-180,
-85,
180,
85,
(point, lng, lat) => ({ point, lng, lat }),
(lng, lat, count, clusterId) => ({ count, clusterId, lng, lat })
);
constructor(getLngLat: (item: T) => [lng: number, lat: number], options: MarkerClusterOptions)
Name | Type | Description | Default |
---|---|---|---|
extent? | number | tile extent (radius is calculated relative to it) | 256 |
maxZoom? | number | max zoom level to cluster the points on | 16 |
minZoom? | number | min zoom level to cluster the points on | 0 |
radius? | number | cluster radius in pixels | 60 |
load(points: T[]): void
Loads given points
Name | Type | Description |
---|---|---|
points | T [] | points for clustering |
async loadAsync(points: T[]): Promise<void>
Same to load, but do clustering at another thread
Note: this method use Worker
cleanUp(): void
if loadAsync was called, use this method before MarkerCluster
instance has gone
getPoints<M, C>(
zoom: number,
westLng: number,
southLat: number,
eastLng: number,
northLat: number,
markerMapper: (point: T, lng: number, lat: number) => M,
clusterMapper: (lng: number, lat: number, count: number, clusterId: number) => C,
expand?: number
): (M | C)[]
Name | Type | Description |
---|---|---|
expand? | number | for values in range (0..1) considered as percentage, otherwise as absolute pixels value to expand given boundary . |
Array of clusters and points for the given zoom
and boundary
getZoom(clusterId: number): number
Zoom level on which the cluster splits into several children, or -1
if it cluster of several points with same coords
getChildren(clusterId: number): (T | { clusterId: number; count: number })[]
points?: T[]
points
from last executed loadAsync or load
worker?: Worker;
Worker instance, inits at first loadAsync call
MIT © Krombik
FAQs
library for point clustering
The npm package marker-cluster receives a total of 116 weekly downloads. As such, marker-cluster popularity was classified as not popular.
We found that marker-cluster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.