TODO: Add a map demo here.
Creating a Tree
var tree = ;
An optional argument to
rbush_geo defines the maximum number of entries in a tree node.
It drastically affects the performance, so you should adjust it
considering the type of data and search queries you perform.
Adding and Removing Data
Insert an item:
var item = 20 40; // [lat, lng]tree;
Clear all items:
RBushGeo assumes the format of data points to be
Bulk-insert the given data into the tree:
// load(lat, lng)tree;
Bulk insertion is usually ~2-3 times faster than inserting items one by one. After bulk loading (bulk insertion into an empty tree), subsequent query performance is also ~20-30% better.
When you do bulk insertion into an existing tree, it bulk-loads the given data into a separate tree and inserts the smaller tree into the larger tree. This means that bulk insertion works very well for clustered data (where items are close to each other), but makes query performance worse if the data is scattered.
// search(southWest, northEast)var result = tree;
Returns an array of data items (points or rectangles) that the given bounding box (
[minX, minY, maxX, maxY]) intersects.
var allItems = treeall;
Returns all items of the tree.
npm install # install dependencies
This project has not a formal release.