Skip to content
New issue

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

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

Already on GitHub? # to your account

KNN for nearby command #136

Closed
tidwall opened this issue Jan 24, 2017 · 3 comments
Closed

KNN for nearby command #136

tidwall opened this issue Jan 24, 2017 · 3 comments

Comments

@tidwall
Copy link
Owner

tidwall commented Jan 24, 2017

It's been often requested to allow for a NEARBY request to order the results by the distance to the target point and to limit by a count rather than a radius.

Including the LIMIT and DISTANCES keyword, and excluding the radius (meters) parameter, Tile38 will guarantee:

  • The results will be order by the distance nearest to the target point.
  • Each resulting object will include the distance to the target point in meters.
  • The number of objects returned will not exceed the value of LIMIT

For example:

NEARBY fleet LIMIT 10 DISTANCES POINT 33.374 -115.829

This will return up to, but not exceeding, 10 objects which are ordered by their distance to the target point 33.374 -115.829.

It may be worth noting that the CURSOR keyword is not compatible with this feature, at least not for the initial release.

@m1ome
Copy link
Contributor

m1ome commented Jan 24, 2017

@tidwall i think we can implement right now in a hacky-way, just adding mix of DISTANCE and LIMIT command, and then measure speed. After merge or cancel we can improve it with KNN algo. Sound good?

@tidwall
Copy link
Owner Author

tidwall commented Jan 24, 2017

@m1ome Yes, that sounds like a good start.

@m1ome
Copy link
Contributor

m1ome commented Jan 24, 2017

@tidwall submitted PR #138

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants