leaflet-extras / rtree Goto Github PK
View Code? Open in Web Editor NEWR-Tree Library for Javascript, optimized for maps.
Home Page: http://leaflet-extras.github.com/RTree/examples/map.html
License: MIT License
R-Tree Library for Javascript, optimized for maps.
Home Page: http://leaflet-extras.github.com/RTree/examples/map.html
License: MIT License
need tests for rTree.geoJSON and rTree.bbox
I've been tinkering with this module. In my tests this happens:
Any nodes inserted after the first will not be revealed in a search if they do not intersect with the initial rectangle. The initial insert is the root bounding box. Is this by design?
When using the library in IE8, it fails on Array.isArray. Possibly also true for IE7.
The examples show how to use delete function
###Usage:
•Deletes all object that touch the 10x10 rectangle starting at position 10x10:
• var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10});
•Delete only specific object if it touches the 10x10 rectangle starting at position 10x10:
• var myDelCount = myRTree.delete({x:10, y:10, w:10, h:10}, specific_object);
But no such function appears to be defined.
What is the reason behind adding the callback arguments to purely synchronous methods? It doesn't add any value since all the methods are still sync, but complicates the code.
We can either try to see if @maxogden (ping) wants to update the current one, or think up a witty name for this on npm, if it's the latter case I'm thinking "arrTree"
It would be nice to have a separate supported RTree implementation without the GeoJSON stuff that can be used for general use cases, and additionally a rtree-geojson.js
extension or something like this.
I don't see any reason to have them combined if this is going to become a standard RTree JS implementation.
Hi,
As far as I can see, when inserting an object to structure, algorithm chooses best node based on squarifiedRatio
(rtree.js#L144-L161) . So the more square the region is better, right? Why?
As can be seen in the tests, not all of the deleted nodes are returned. The actual circumstances seem to be depended on both the nodes and the shape of pages as adding the same data into the tree in a different order can effect this.
how to limit the count of search rtree.bbox(area, limit) ?
I want to limit max 5 feature returned by rtree.bbox(area, 5) or rtree.search(area, 5)
How to do that?
currently rTree.geoJSON can't handle geometry collections, this should be fixed.
I noticed references to JSON.parse and JSON.stringify, which are not available on IE7 and 8. Which kind of browsers do you intent to support?
Hi there, so I've run into an issue with floating point precision when searching for exact points in an rtree. For a demonstration of this bug, grab my test case located on my fork here and run it a few times on the current build. You'll get some output similar to this:
$ node searchexact.test.js
TAP version 13
# RTree Searching for exact point
not ok 1 1k In-Bounds Searches
---
operator: equal
expected: 1000
actual: 997
at: Test.<anonymous> (/home/centos/proj/rtree/RTree/test/searchexact.test.js:23:5)
...
1..1
# tests 1
# pass 0
# fail 1
$ node searchexact.test.js
TAP version 13
# RTree Searching for exact point
not ok 1 1k In-Bounds Searches
---
operator: equal
expected: 1000
actual: 997
at: Test.<anonymous> (/home/centos/proj/rtree/RTree/test/searchexact.test.js:23:5)
...
1..1
# tests 1
# pass 0
# fail 1
$ node searchexact.test.js
TAP version 13
# RTree Searching for exact point
not ok 1 1k In-Bounds Searches
---
operator: equal
expected: 1000
actual: 998
at: Test.<anonymous> (/home/centos/proj/rtree/RTree/test/searchexact.test.js:23:5)
...
1..1
# tests 1
# pass 0
# fail 1
I've created a patch and submitted a PR (#34) for review. My solution was to introduce an epsilon and to check bounds relative to this epsilon.
how to make indoor map by leaflet. i want to learn how to make it.
Good
When passing a single geojson feature to the rtree, it fails with the message "this isn't what we're looking for".
I propose a patch which checks if 'prelim' is an Object. If so, we expect it to be a single feature, and then we put it in an Array, so it fits in the rest of the code nicely. Would that be acceptable? If so, how to clone (see #23): Do I implement a pure javascript clone function, or JSON.parse(JSON.stringify(prelim))? See http://heyjavascript.com/4-creative-ways-to-clone-objects/. I would be happy to contribute this patch.
The patch I proposed yesterday I did in lib/rtree.js because I assumed dist/rtree.min.js and dist/rtree.js are build from there. Was that correct?
The README.md says that is is a port of Jon-Carlos Rivera's library. We used Jon-Carlos's RTree library in OpenLayers 3, but found that @mourner's rbush was much, much better. Compare the two screenshots below: the first is RTree, the second is rbush:
If this library is based on RTree, you may wish to consider switching to rbush.
Should probably have a version of the tests that runs in node.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.