{"id":16919786,"url":"https://github.com/deniscarriere/geojson-rbush","last_synced_at":"2025-03-17T07:31:32.013Z","repository":{"id":18918519,"uuid":"85572937","full_name":"DenisCarriere/geojson-rbush","owner":"DenisCarriere","description":"GeoJSON implementation of RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles","archived":false,"fork":false,"pushed_at":"2023-02-28T19:19:05.000Z","size":2105,"stargazers_count":70,"open_issues_count":14,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T19:39:24.487Z","etag":null,"topics":["algorithm","computational-geometry","geojson","javascript","r-tree","spatial-index"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DenisCarriere.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-20T12:14:08.000Z","updated_at":"2024-01-28T07:08:58.000Z","dependencies_parsed_at":"2024-10-13T19:45:44.318Z","dependency_job_id":"792422a2-9c82-4081-8122-ff5fd07c4345","html_url":"https://github.com/DenisCarriere/geojson-rbush","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeojson-rbush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeojson-rbush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeojson-rbush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DenisCarriere%2Fgeojson-rbush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DenisCarriere","download_url":"https://codeload.github.com/DenisCarriere/geojson-rbush/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852428,"owners_count":20358267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["algorithm","computational-geometry","geojson","javascript","r-tree","spatial-index"],"created_at":"2024-10-13T19:45:37.983Z","updated_at":"2025-03-17T07:31:31.685Z","avatar_url":"https://github.com/DenisCarriere.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GeoJSON RBush\n\n[![Build Status](https://travis-ci.org/DenisCarriere/geojson-rbush.svg?branch=master)](https://travis-ci.org/DenisCarriere/geojson-rbush)\n[![npm version](https://badge.fury.io/js/geojson-rbush.svg)](https://badge.fury.io/js/geojson-rbush)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/DenisCarriere/geojson-rbush/master/LICENSE)\n\nGeoJSON implementation of [RBush](https://github.com/mourner/rbush) — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles.\n\n## Install\n\n**npm**\n\n```bash\n$ npm install --save geojson-rbush\n```\n\n## API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n-   [rbush](#rbush)\n-   [insert](#insert)\n-   [load](#load)\n-   [remove](#remove)\n-   [clear](#clear)\n-   [search](#search)\n-   [collides](#collides)\n-   [all](#all)\n-   [toJSON](#tojson)\n-   [fromJSON](#fromjson)\n\n### rbush\n\nGeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.\n\n**Parameters**\n\n-   `maxEntries` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** defines the maximum number of entries in a tree node. 9 (used by default) is a\n    reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa. (optional, default `9`)\n\n**Examples**\n\n```javascript\nvar geojsonRbush = require('geojson-rbush').default;\nvar tree = geojsonRbush();\n```\n\nReturns **RBush** GeoJSON RBush\n\n### insert\n\n[insert](https://github.com/mourner/rbush#data-format)\n\n**Parameters**\n\n-   `feature` **Feature** insert single GeoJSON Feature\n\n**Examples**\n\n```javascript\nvar poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\ntree.insert(poly)\n```\n\nReturns **RBush** GeoJSON RBush\n\n### load\n\n[load](https://github.com/mourner/rbush#bulk-inserting-data)\n\n**Parameters**\n\n-   `features` **(FeatureCollection | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;Feature\u003e)** load entire GeoJSON FeatureCollection\n\n**Examples**\n\n```javascript\nvar polys = turf.polygons([\n    [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],\n    [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]\n]);\ntree.load(polys);\n```\n\nReturns **RBush** GeoJSON RBush\n\n### remove\n\n[remove](https://github.com/mourner/rbush#removing-data)\n\n**Parameters**\n\n-   `feature` **Feature** remove single GeoJSON Feature\n-   `equals` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Pass a custom equals function to compare by value for removal.\n\n**Examples**\n\n```javascript\nvar poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n\ntree.remove(poly);\n```\n\nReturns **RBush** GeoJSON RBush\n\n### clear\n\n[clear](https://github.com/mourner/rbush#removing-data)\n\n**Examples**\n\n```javascript\ntree.clear()\n```\n\nReturns **RBush** GeoJSON Rbush\n\n### search\n\n[search](https://github.com/mourner/rbush#search)\n\n**Parameters**\n\n-   `geojson` **(BBox | FeatureCollection | Feature)** search with GeoJSON\n\n**Examples**\n\n```javascript\nvar poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n\ntree.search(poly);\n```\n\nReturns **FeatureCollection** all features that intersects with the given GeoJSON.\n\n### collides\n\n[collides](https://github.com/mourner/rbush#collisions)\n\n**Parameters**\n\n-   `geojson` **(BBox | FeatureCollection | Feature)** collides with GeoJSON\n\n**Examples**\n\n```javascript\nvar poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n\ntree.collides(poly);\n```\n\nReturns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if there are any items intersecting the given GeoJSON, otherwise false.\n\n### all\n\n[all](https://github.com/mourner/rbush#search)\n\n**Examples**\n\n```javascript\ntree.all()\n```\n\nReturns **FeatureCollection** all the features in RBush\n\n### toJSON\n\n[toJSON](https://github.com/mourner/rbush#export-and-import)\n\n**Examples**\n\n```javascript\nvar exported = tree.toJSON()\n```\n\nReturns **any** export data as JSON object\n\n### fromJSON\n\n[fromJSON](https://github.com/mourner/rbush#export-and-import)\n\n**Parameters**\n\n-   `json` **any** import previously exported data\n\n**Examples**\n\n```javascript\nvar exported = {\n  \"children\": [\n    {\n      \"type\": \"Feature\",\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [110, 50]\n      },\n      \"properties\": {},\n      \"bbox\": [110, 50, 110, 50]\n    }\n  ],\n  \"height\": 1,\n  \"leaf\": true,\n  \"minX\": 110,\n  \"minY\": 50,\n  \"maxX\": 110,\n  \"maxY\": 50\n}\ntree.fromJSON(exported)\n```\n\nReturns **RBush** GeoJSON RBush\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeniscarriere%2Fgeojson-rbush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeniscarriere%2Fgeojson-rbush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeniscarriere%2Fgeojson-rbush/lists"}