Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-rtree

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-rtree

an async rtree suitable for use with leveldb

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23
increased by1050%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 23 Nov 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc