Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What if i want to do the K-NN request without getting result in a time? #52

Open
Henryypc opened this issue Jun 13, 2016 · 8 comments
Open
Labels

Comments

@Henryypc
Copy link

Hello, davidmoten
Thanks for reading my questions.
I want to do the K-NN query to a MBR but i don't know how much will k be. I want to get the result set incrementally. For example.It's a while loop. In each round, i want to get 5 more K-NN MBRs. What can i do to reach this goal in your code?

Looking forward to your reply.
Thanks very much!

BTW, your code really helped me a lot! Thank you very much!

@davidmoten
Copy link
Owner

What determines when k is enough for you?

@Henryypc
Copy link
Author

Thank you very much for reply.
The terminating condition is depended by the data i get from Rtree, so i don't know when the k is enough. I want to design a dynamic algorithm to search rtree by an increasing radius r. And in each round,r=r+lambda, i don't need to search the MBR within radius r in each round, i only need to search the MBR between r and r+lambda. So I plan to mark the distance in the each round and continue in the next round. But i don't know how to...
Thank you again!

@davidmoten
Copy link
Owner

Interesting question. Essentially you want to be able to search with a custom geometry which is a donut.

In the README there are a list of conditions that need to be met for an RTree to be an applicable data structure for a custom geometry. They are:

  • distance(r) >= 0 for all rectangles r
  • if rectangle r1 contains r2 then distance(r1)<=distance(r2)
  • distance(r) = 0 if and only if the geometry intersects the rectangle r

The trouble is for a donut the second condition does not always hold. Imagine a donut inside a rectangle r1 and another rectangle r2 inside the hole of the donut. The distance from the donut to r1 is 0 yet the distance from the donut to r2 is > 0.

Given this limitation I think you will need to do a search of r+lambda and remove the results of a search of r.

@Henryypc
Copy link
Author

I think i understand what you mean. I will try what you said. Thank you for answering my queations. Thank you a lot!

@Henryypc
Copy link
Author

Thank you for your help, and I find the algorithm i want to use, which is given in this paper.

Distance Browsing in Spatial Databases
GÍSLI R. HJALTASON and HANAN SAMET
University of Maryland

Maybe it can help you for your R-tree related project.

@davidmoten
Copy link
Owner

Cool. I'll have a look.

On 19 June 2016 at 16:28, Henryypc notifications@github.com wrote:

Thank you for your help, and I find the algorithm i want to use, which is
given in this paper.

Distance Browsing in Spatial Databases
GÍSLI R. HJALTASON and HANAN SAMET
University of Maryland

Maybe it can help you for your R-tree related project.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#52 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AATa650zUzAALiEbIHNj0a8dwP0rWu22ks5qNOGXgaJpZM4I0FY6
.

@davidmoten
Copy link
Owner

That paper is great. I'll put that on my backlog to consider integrating with this project. Thanks for the info!

@Henryypc
Copy link
Author

That's cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants