{"_id":"kdbush","_rev":"408311","name":"kdbush","description":"A very fast static 2D index for points based on kd-tree.","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"time":{"modified":"2021-08-04T04:58:00.000Z","created":"2016-04-08T23:31:33.030Z","3.0.0":"2018-09-07T08:54:55.968Z","2.0.1":"2018-06-07T16:22:22.538Z","2.0.0":"2018-06-07T16:20:51.701Z","1.0.1":"2016-10-18T21:19:14.261Z","1.0.0":"2016-04-08T23:31:33.030Z"},"users":{"uptonking":true},"author":{"name":"Vladimir Agafonkin"},"repository":{"type":"git","url":"git://github.com/mourner/kdbush.git"},"versions":{"3.0.0":{"name":"kdbush","version":"3.0.0","description":"A very fast static 2D index for points based on kd-tree.","module":"src/index.js","main":"kdbush.js","jsdelivr":"kdbush.min.js","unpkg":"kdbush.min.js","repository":{"type":"git","url":"git://github.com/mourner/kdbush.git"},"devDependencies":{"eslint":"^5.5.0","eslint-config-mourner":"^3.0.0","esm":"^3.0.82","rollup":"^0.65.2","rollup-plugin-buble":"^0.19.2","rollup-plugin-terser":"^2.0.2","tape":"^4.9.1"},"scripts":{"pretest":"eslint src test.js bench.js rollup.config.js","test":"tape -r esm test.js","bench":"node -r esm bench.js","build":"rollup -c","prepublishOnly":"npm run build"},"eslintConfig":{"extends":"mourner"},"keywords":["index","points","kd-tree","data structures","algorithms","spatial","geometry"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"5ff01fb69666443270db1f136b79ba4588645ab8","bugs":{"url":"https://github.com/mourner/kdbush/issues"},"homepage":"https://github.com/mourner/kdbush#readme","_id":"kdbush@3.0.0","_npmVersion":"6.3.0","_nodeVersion":"10.9.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"f8484794d47004cc2d85ed3a79353dbe0abc2bf0","size":5033,"noattachment":false,"key":"/kdbush/-/kdbush-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/kdbush/download/kdbush-3.0.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kdbush_3.0.0_1536310495834_0.4486660538682752"},"_hasShrinkwrap":false,"publish_time":1536310495968,"_cnpm_publish_time":1536310495968},"2.0.1":{"name":"kdbush","version":"2.0.1","description":"A very fast static 2D index for points based on kd-tree.","module":"src/index.js","main":"kdbush.js","jsdelivr":"dist/kdbush.min.js","unpkg":"dist/kdbush.min.js","repository":{"type":"git","url":"git://github.com/mourner/kdbush.git"},"devDependencies":{"eslint":"^4.19.1","eslint-config-mourner":"^2.0.1","esm":"^3.0.48","rollup":"^0.60.0","rollup-plugin-uglify":"^4.0.0","tape":"^4.6.2"},"scripts":{"pretest":"eslint test.js src","test":"tape -r esm test.js","bench":"node -r esm bench.js","build":"rollup -c"},"eslintConfig":{"extends":"mourner","parserOptions":{"sourceType":"module"}},"keywords":["index","points","kd-tree","data structures","algorithms","spatial","geometry"],"files":["kdbush.js","kdbush.min.js","src"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"1e4879151c30c32f84a5c797a59480bbf719cb4d","bugs":{"url":"https://github.com/mourner/kdbush/issues"},"homepage":"https://github.com/mourner/kdbush#readme","_id":"kdbush@2.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"90c6128e3001ac68c550d7c9e2f222c0269666f1","size":4642,"noattachment":false,"key":"/kdbush/-/kdbush-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/kdbush/download/kdbush-2.0.1.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kdbush_2.0.1_1528388542446_0.4293094961336368"},"_hasShrinkwrap":false,"publish_time":1528388542538,"_cnpm_publish_time":1528388542538},"2.0.0":{"name":"kdbush","version":"2.0.0","description":"A very fast static 2D index for points based on kd-tree.","module":"src/index.js","main":"kdbush.js","jsdelivr":"dist/supercluster.min.js","unpkg":"dist/supercluster.min.js","repository":{"type":"git","url":"git://github.com/mourner/kdbush.git"},"devDependencies":{"eslint":"^4.19.1","eslint-config-mourner":"^2.0.1","esm":"^3.0.48","rollup":"^0.60.0","rollup-plugin-uglify":"^4.0.0","tape":"^4.6.2"},"scripts":{"pretest":"eslint test.js src","test":"tape -r esm test.js","bench":"node -r esm bench.js","build":"rollup -c"},"eslintConfig":{"extends":"mourner","parserOptions":{"sourceType":"module"}},"keywords":["index","points","kd-tree","data structures","algorithms","spatial","geometry"],"files":["kdbush.js","kdbush.min.js","src"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"7049f63fb88e4d20fd6328071569ae3a409497bc","bugs":{"url":"https://github.com/mourner/kdbush/issues"},"homepage":"https://github.com/mourner/kdbush#readme","_id":"kdbush@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"686a369c0f4eadcbf56de7a343b052e872414fed","size":4666,"noattachment":false,"key":"/kdbush/-/kdbush-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/kdbush/download/kdbush-2.0.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kdbush_2.0.0_1528388451515_0.23063574600424874"},"_hasShrinkwrap":false,"publish_time":1528388451701,"_cnpm_publish_time":1528388451701},"1.0.1":{"name":"kdbush","version":"1.0.1","description":"A very fast static 2D index for points based on kd-tree.","main":"src/kdbush.js","repository":{"type":"git","url":"git://github.com/mourner/kdbush.git"},"devDependencies":{"eslint":"^3.8.1","eslint-config-mourner":"^2.0.1","tape":"^4.6.2"},"scripts":{"pretest":"eslint test.js src","test":"tape test.js"},"eslintConfig":{"extends":"mourner"},"keywords":["index","points","kd-tree","data structures","algorithms","spatial","geometry"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"ae855f35b650f2c37168ac2b6ee86523f6f8500e","bugs":{"url":"https://github.com/mourner/kdbush/issues"},"homepage":"https://github.com/mourner/kdbush#readme","_id":"kdbush@1.0.1","_shasum":"3cbd03e9dead9c0f6f66ccdb96450e5cecc640e0","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"3cbd03e9dead9c0f6f66ccdb96450e5cecc640e0","size":11443,"noattachment":false,"key":"/kdbush/-/kdbush-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/kdbush/download/kdbush-1.0.1.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/kdbush-1.0.1.tgz_1476825553691_0.5103460270911455"},"directories":{},"publish_time":1476825554261,"_cnpm_publish_time":1476825554261,"_hasShrinkwrap":false},"1.0.0":{"name":"kdbush","version":"1.0.0","description":"A very fast static 2D index for points based on kd-tree.","main":"src/kdbush.js","dependencies":{"tape":"^4.5.1"},"devDependencies":{"eslint":"^2.7.0","eslint-config-mourner":"^2.0.0"},"scripts":{"pretest":"eslint test.js src","test":"tape test.js"},"eslintConfig":{"extends":"mourner"},"keywords":["index","points","kd-tree","data structures","algorithms","spatial","geometry"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"d23804a5cd48402fb43ad06bfc30ee8268b97b0d","_id":"kdbush@1.0.0","_shasum":"d8e629fde90a6bcf6e1b54bc73c30cb2cbf71013","_from":".","_npmVersion":"2.15.2","_nodeVersion":"5.10.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"d8e629fde90a6bcf6e1b54bc73c30cb2cbf71013","size":4516,"noattachment":false,"key":"/kdbush/-/kdbush-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/kdbush/download/kdbush-1.0.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/kdbush-1.0.0.tgz_1460158292039_0.2931215846911073"},"directories":{},"publish_time":1460158293030,"_cnpm_publish_time":1460158293030,"_hasShrinkwrap":false}},"readme":"## KDBush [![Build Status](https://travis-ci.org/mourner/kdbush.svg?branch=master)](https://travis-ci.org/mourner/kdbush) [![Simply Awesome](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)\n\nA very fast static spatial index for 2D points based on a flat KD-tree.\nCompared to [RBush](https://github.com/mourner/rbush):\n\n- points only — no rectangles\n- static — you can't add/remove items\n- indexing is 5-8 times faster\n\n```js\nconst index = new KDBush(points);         // make an index\nconst ids1 = index.range(10, 10, 20, 20); // bbox search - minX, minY, maxX, maxY\nconst ids2 = index.within(10, 10, 5);     // radius search - x, y, radius\n```\n\n## Install\n\nInstall using NPM (`npm install kdbush`) or Yarn (`yarn add kdbush`), then:\n\n```js\n// import as a ES module\nimport KDBush from 'kdbush';\n\n// or require in Node / Browserify\nconst KDBush = require('kdbush');\n```\n\nOr use a browser build directly:\n\n```html\n<script src=\"https://unpkg.com/kdbush@2.0.0/kdbush.min.js\"></script>\n```\n\n## API\n\n#### new KDBush(points[, getX, getY, nodeSize, arrayType])\n\nCreates an index from the given points.\n\n- `points`: Input array of points.\n- `getX`, `getY`: Functions to get `x` and `y` from an input point. By default, it assumes `[x, y]` format.\n- `nodeSize`: Size of the KD-tree node, `64` by default. Higher means faster indexing but slower search, and vise versa.\n- `arrayType`: Array type to use for storing coordinate values. `Float64Array` by default, but if your coordinates are integer values, `Int32Array` makes things a bit faster.\n\n```js\nconst index = kdbush(points, p => p.x, p => p.y, 64, Int32Array);\n```\n\n#### index.range(minX, minY, maxX, maxY)\n\nFinds all items within the given bounding box and returns an array of indices that refer to the items in the original `points` input array.\n\n```js\nconst results = index.range(10, 10, 20, 20).map(id => points[id]);\n```\n\n#### index.within(x, y, radius)\n\nFinds all items within a given radius from the query point and returns an array of indices.\n\n```js\nconst results = index.within(10, 10, 5).map(id => points[id]);\n```\n","_attachments":{},"homepage":"https://github.com/mourner/kdbush#readme","bugs":{"url":"https://github.com/mourner/kdbush/issues"},"license":"ISC"}