JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5309
  • Score
    100M100P100Q128736F
  • License MIT

Fast nd point clustering.

Package Exports

  • point-cluster

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 (point-cluster) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

point-cluster Build Status experimental

Point clustering for 2D spatial indexing. Incorporates optimized quad-tree data structure.

const cluster = require('point-cluster')

let tree = cluster(points)

// get point ids within the indicated range
let ids = tree.range(10, 10, 20, 20)

API

points = cluster(coords, options?)

Create index tree for the set of 2d coords based on options.

points is an array of [x,y, x,y, ...] or [[x,y], [x,y], ...] coordinates.

options

Option Default Description
bounds auto Data bounds, if different from coords bounds, eg. in case of subdata.
maxDepth 8192 Max number of levels.

points.levels

Point ids distributed by zoom levels of details. Handy to form a buffer in WebGL and use points.lod method to get subranges of buffer to render.

points.range(minX, minY, maxX, maxY)

Get point ids from the indicated range.

points.lod(pxSize, minX, minY, maxX, maxY)

Get offsets for the points visible at a specific zoom level and range. Returns list of arrays corresponding to points.levels ranges, eg. [[120, 200], [1120, 1540], ...]. Useful for obtaining subranges to render.

License

© 2017 Dmitry Yv. MIT License

Development supported by plot.ly.