
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
A non-recursive R-Tree library in pure JavaScript with no dependencies. Fork of Jon-Carlos Rivera's fantastic library which sadly seems not to be maintained. MIT Licensed.
##So far:
##API
###Parameters:
###Returns:
###Usage:
var myRTree = RTree(10);##rTree.insert
###Parameters:
###Returns:
###Usage:
myRTree.insert({x:10, y:10, w:10, h:10}, myObject);##rTree.remove
###Parameters:
###Returns:
###Usage:
var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10});var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10}, specific_object);##rTree.geoJSON:
###Parameters
###Usage:
myRTree.geoJSON({
"type":"FeatureCollection",
"features":[
{
"type":"Feature",
"geometry":{
"type":"Point",
"coordinates":[100,1]
},
"properties":{
"prop0":"value0"
}
},
{
"type":"Feature",
"geometry":{
"type":"LineString",
"coordinates":[
[100,0],
[101,1]
]
},
"properties":{
"prop0":"value0"
}
}
]
});
##rTree.bbox:
###Parameters
[[x1,y1],[x2,y2]], two parameters representing the southwest and northeast corners [x1,y1],[x2,y2], or 4 parameters of [x1,y1,x2,y2].###Returns:
###Usage:
var myObjects1 = myRTree.bbox([[10,10],[20,20]]);var myObjects2 = myRTree.bbox([[10,10],[20,20]]);var myObjects3 = myRTree.bbox([10,10],[20,20]);var myObjects4 = myRTree.bbox([10,10],[20,20]);var myObjects5 = myRTree.bbox(10,10,20,20);var myObjects6 = myRTree.bbox(10,10,20,20);##rTree.search
###Parameters:
###Returns:
###Usage:
var myObjects = myRTree.search({x:10, y:10, w:10, h:10});###Notes
1 Default max node width is currently 6.
3 A Rectangle is any object with public x, y, w, h properties. The object itself is not saved or used directly but copies are made of its x, y, w, h properties.
FAQs
rtree library for javascript
The npm package rtree receives a total of 34,996 weekly downloads. As such, rtree popularity was classified as popular.
We found that rtree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.