Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/calvinmetcalf/level-tree
R-tree spatial index for GeoJSON in LevelDB
https://github.com/calvinmetcalf/level-tree
Last synced: 12 days ago
JSON representation
R-tree spatial index for GeoJSON in LevelDB
- Host: GitHub
- URL: https://github.com/calvinmetcalf/level-tree
- Owner: calvinmetcalf
- License: mit
- Created: 2013-12-24T20:27:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-09-08T22:34:47.000Z (about 10 years ago)
- Last Synced: 2024-10-23T08:03:18.184Z (17 days ago)
- Language: JavaScript
- Homepage:
- Size: 1.49 MB
- Stars: 18
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
- awesome-starred - calvinmetcalf/level-tree - R-tree spatial index for GeoJSON in LevelDB (others)
README
Level Tree [![Build Status](https://travis-ci.org/calvinmetcalf/level-tree.svg)](https://travis-ci.org/calvinmetcalf/level-tree)
====An RTree index for levelup, usage
```bash
npm install --save level-tree
``````js
var level = require('level');
var sublevel = require('level-sublevel');
var levelTree = require('level-tree');
var db = levelTree(sublevel(level('./name')));
// load in some geojson
db.treeQuery([xmin, ymin, xmax, ymax]).pipe();
db.treeQuery([xmin, ymin, xmax, ymax], callback);
// nonstrict query
db.treeQuery([xmin, ymin, xmax, ymax], false).pipe();
db.treeQuery([xmin, ymin, xmax, ymax], false, callback);
```adds a treeQuery method, which either takes a bbox and returns a stream, or a bbox and a callback.
you can also pass false as the second argument to treeQuery, this turns off checks to make sure that the bbox you query actually intersects the feature that is returned and not just it's bbox. These checks can be very expensive especially for polygons so turning them off when you have mostly rectangular features or when you just don't care will speed things up.