Comments (4)
Glad you are finding the library useful!
If the dimensions of the axes are very different then that might have negative effects on the performance of the rtree because of bias to or away from an axis. I would normally suggest translating and scaling the coordinates in this case say so they are in the 0..1 range.
Euclidean distance doesn't sound like it has a lot of meaning as you point out. I would just do a search with a rectangle (x-xDistance, y-yDistance, x+xDistance, y+yDistance)
which seems to match your use case exactly. Am I missing something?
from rtree.
That's what I'm doing now (search with a rectangle), but it finds everything that intersects the query. In my case such a search might bring up a lot of unnecessary stuff (e.g. some large rectangles that are also in the tree), I thought that it could be much more efficient to do nearest()
with small k
because I only need the closest things to my query point.
After writing this I think I know what I'm missing -- a method like search(Geometry g, boolean fullyEncloses)
. Instead of intersections I'd like to be able to find all things that are completely enclosed by the query. In case of arbitrary geometries that would be full enclosure of their bounding boxes.
I don't know if such queries are possible/easy to implement with an RTree. If not, then a nearest()
with different constraints for coordinates might work.
from rtree.
To get the contains seach you would do this:
RTree<Object, Rectangle> tree = ...;
List<Entry<Object,Rectangle>> entries =
tree
.search(rect)
.filter(entry -> rect.contains(entry.geometry()))
.toList().toBlocking().single();
This will be the most efficient way of doing it and any api additions would probably do this under the covers. Are you using filter
with the returned observable as above?
from rtree.
No, I wasn't using filter
, I thought that some direct serach solution would be faster. But since you say this is how you'd implement this type of query anyway, I just have to believe you :)
Thank you!
PS: I guess this can be added to the readme (how to perform contains
queries)
from rtree.
Related Issues (20)
- 0.8.7 version method add in RTree HOT 1
- RTree search function not invoking callback function number of expected times HOT 9
- How can I use R-tree and R*-tree to store roads information and use circle to search point nearest roads?
- How to serialize all geometry? HOT 1
- How to add the count of data points and their linear sum for each MBR HOT 1
- Rtree can't insert anything HOT 2
- The unit of Circle radius is in meter? HOT 2
- Question: how to find overlapping circles? HOT 4
- How to do an incremental knn search? HOT 5
- Pre conditions failing in Rectangle Implementation HOT 2
- Honour minChildren with delete operation HOT 1
- Is the unit of the parameter radius in CircleDouble. create (x, y, radius) in meters? What other unit is it? HOT 2
- Difference between LineDouble and LineFloat
- Is there a way to have sampled results over a geographical search ? HOT 3
- Incorrect result for horizontal line search HOT 4
- Rxjava2 version available? HOT 2
- Would you plan to provide a method that deletes entries according to a value? HOT 2
- rtree2 HOT 2
- [Question] A R-Tree search performance question HOT 7
- Propose to store the geographic rectangles in Integer rather than in Float
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtree.