Socket
Socket
Sign inDemoInstall

hilbert-rtree

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hilbert-rtree

This is an implementation of a Hilbert Packed R-Tree without any external dependencies. R-Trees are a special data structure for indexing spatial data. To improve the performance of query operations on the data structure, the R-Tree may be packed using t


Version published
Weekly downloads
476
decreased by-47.52%
Maintainers
1
Install size
29.4 kB
Created
Weekly downloads
 

Changelog

Source

2.0.2 (2022-01-01)

Bug Fixes

  • remove dependency on nodejs lib "assert" (5f6e6f5)

Readme

Source

Hilbert Packed R-Tree in Typescript

This is an implementation of a Hilbert Packed R-Tree without any external dependencies. R-Trees are a special data structure for indexing spatial data. To improve the performance of query operations on the data structure, the R-Tree may be packed using the space filling Hilbert Curve.

Requirements

This library may be used in browser environments and does not depend on NodeJS libraries.

Without polyfilling, the implementation depends on features available in node >= 8.

Installation

npm i -S hilbert-rtree

Usage

const options = { maxChildrenPerNode: 4 };
const tree = new RTree(
  options /** optional argument */
);

const records = [
  {
    x: 0, y: 0, width: 10, height: 10, data: "This can be any data type"
  },
  { x: 30, y: 30, data: "Data may also be stored as a point rather than a rectangle" },
];

// Batch insert records. The tree is packet using a Hilbert curve.
tree.batchInsert(records);

// The spatial R-Tree is queried by using a bounding box. The search
// returns data records that overlap with query rectangle.
const boundingRectangle = {
  x: 0, y: 0, width: 5, height: 5
};
const result = tree.search(boundingRectangle);

console.log(result); // -> prints: [ "This can be any data type" ]

API

Documentation is available here

Keywords

FAQs

Last updated on 01 Jan 2022

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