{"id":15483503,"url":"https://github.com/hackergrrl/grid-point-store","last_synced_at":"2026-03-17T09:41:07.971Z","repository":{"id":57144570,"uuid":"100743162","full_name":"hackergrrl/grid-point-store","owner":"hackergrrl","description":"Fast 2D point insertions and spatial querying over grid of fixed size cells.","archived":false,"fork":false,"pushed_at":"2018-02-03T01:07:27.000Z","size":34,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T11:52:24.563Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackergrrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-18T19:18:01.000Z","updated_at":"2022-12-12T23:22:57.000Z","dependencies_parsed_at":"2022-09-03T07:02:26.114Z","dependency_job_id":null,"html_url":"https://github.com/hackergrrl/grid-point-store","commit_stats":null,"previous_names":["noffle/grid-point-store"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/hackergrrl/grid-point-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fgrid-point-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fgrid-point-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fgrid-point-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fgrid-point-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackergrrl","download_url":"https://codeload.github.com/hackergrrl/grid-point-store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fgrid-point-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30620760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T08:10:05.930Z","status":"ssl_error","status_checked_at":"2026-03-17T08:10:04.972Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T05:17:22.536Z","updated_at":"2026-03-17T09:41:07.936Z","avatar_url":"https://github.com/hackergrrl.png","language":"JavaScript","readme":"# grid-point-store\n\n\u003e Fast 2D point insertions and spatial querying over a fixed grid.\n\n## Usage\n\n```js\nvar GeoStore = require('grid-point-store')\nvar memdb = require('memdb')\n\nvar store = GeoStore({\n  store: memdb(),\n  zoomLevel: 14\n})\n\nvar pending = 10\nvar spread = 0.1  // ~10km\nfunction insert () {\n  if (!pending) return check()\n  var x = Math.random() * spread - spread / 2\n  var y = Math.random() * spread - spread / 2\n  var loc = parseInt(Math.random().toString().substring(15))\n  store.insert([y, x], loc, function (err) {\n    pending--\n    insert()\n  })\n}\ninsert()\n\nfunction check () {\n  var bbox = [ [ -1, 1 ], [ -1,  1 ] ]\n  var q = store.queryStream(bbox)\n  q.on('data', function (pt) {\n    console.log('data', pt)\n  })\n}\n```\n\noutputs\n\n```\ndata { point: 0.021974959554208737, -0.036042143780795316 }, value: 486 }\ndata { point: 0.01731653112725491, 0.04090562190958498 }, value: 398 }\ndata { point: -0.0059460250360946695, -0.027539338463307098 }, value: 3 }\ndata { point: -0.037361984139033334, -0.002493949477883839 }, value: 3795 }\ndata { point: -0.043988977366412524, -0.03764949331648002 }, value: 4426 }\ndata { point: -0.045367303981649724, -0.03634679567215611 }, value: 356 }\ndata { point: 0.023642309425643854, 0.017864021495420324 }, value: 81 }\ndata { point: -0.031037061354238983, 0.006035785956166738 }, value: 407 }\ndata { point: 0.03480660267412845, 0.032896501435967895 }, value: 46 }\ndata { point: 0.02960226742605787, 0.027872606373290573 }, value: 788 }\n```\n\n## API\n\n```js\nvar GeoStore = require('grid-point-store')\n```\n\n### var store = GeoStore(opts)\n\nCreate a new point store `store` backed by the LevelUP instance `leveldb`.\n\nValid `opts` include:\n\n- (required) `store`: an [LevelUP](https://github.com/Level/LevelUP) compatible\n  database instance.\n- (optional) `zoomLevel` (integer): an OSM-style zoom level to divide the world\n  up by. `zoomLevel == 1` captures the entire world in 1 tile, `2` in 4 tiles,\n  `3` in 16 tiles, and so forth. Read more on [OSM zoom\n  levels](wiki.openstreetmap.org/wiki/Zoom_levels).\n- (optional) `types` (Array[3]): a size-3 array of [comparable storable type](https://github.com/substack/comparable-storable-types) strings for the\n  X and Y components, with the 3rd being the value format. Defaults to `['float64', 'float64', 'uint32']`.\n\n### store.insert([x, y], value, cb)\n\nInsert a point `[x, y]` with value `value` into the store.\n\n`cb` is a callback that will be called as `cb(err)` if an error occurs, or\n`cb(null)` if the insertion succeeded.\n\n### store.query(bbox[, opts], cb)\n\nQuery a rectangular region for points. `cb` is called with the array of points\nin the region.\n\n`bbox` is an array of arrays of the form\n\n```\n[\n  [ minX, maxX ],\n  [ minY, maxY ]\n]\n```\n\n### var stream = store.queryStream(bbox)\n\nQuery a rectangular region for points. Returns the Readable stream `stream`.\n\n### store.remove(pt[, opts], cb)\n\nDeletes points at `pt` (a size-2 array of the form `[x, y]`).\n\nValid `opts` include\n\n- (optional) `opts.value`: Only delete points at this location with this\n  specific value.\n\n`cb` is a callback that will be called as `cb(err)` if an error occurs, or\n`cb(null)` if the deletion succeeded.\n\n## Caveats\n\n- Missing: stream backpressure on `queryStream`\n\nPRs very welcome! :heart:\n\n## Install\n\nWith [npm](https://npmjs.org/) installed, run\n\n```\n$ npm install grid-point-store\n```\n\n## See Also\n\n- [kdb-tree-store](https://github.com/peermaps/kdb-tree-store)\n- [geohash-point-store](https://github.com/noffle/geohash-point-store)\n\n## License\n\nISC\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackergrrl%2Fgrid-point-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackergrrl%2Fgrid-point-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackergrrl%2Fgrid-point-store/lists"}