Socket
Socket
Sign inDemoInstall

async-rtree

Package Overview
Dependencies
11
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    async-rtree

an async rtree suitable for use with leveldb


Version published
0
Maintainers
1
Install size
644 kB
Created
Weekly downloads
 

Readme

Source

async-rtree Build Status

An async RTree, suitable for use with levelup, based on rbush. Constructor takes an argument 'store', which is a leveldb style datastore with get, put, del, and batch methods.

Internally, it is dimensionally agnostic and all bboxen are expressed in terms of [[min1, ...], [max1, ...]] e.g. [[west, south], [east, north]] or [[xmin, ymin, zmin], [xmax, ymax, zmax]]. Just be consistent in your dimensions. You can generate these from geojson with gbv.

Currently features the following methods

rtree.insert('id', bbox, callback);
rtree.append('id', bbox, callback);
rtree.remove('id', callback);
rtree.remove('id', bbox, callback);
rtree.query(bbox);// returns stream
rtree.query(bbox, cb);// array
rtree.bulk(array, cb);// array members of of the form {id:id, bbox:bbox}

All the rtree stores is the id and bbox, any other data you want to store you need to store elsewhere.

The difference between insert and append is that insert will delete anything with the id currently in the database while append doesn't care if there is one already in there.

A bbox is optional when using remove, if it's ommited then the bboxen are looked up, if a bbox is provided it must be exact, the only reason you'd want to do that is if you have multiple nodes with the same id and only want to remove 1.

todo

  • Batch deletes.

Keywords

FAQs

Last updated on 23 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc