Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Boost Geometry nearest queries always sort results ordered by smallest distance first?

I have made a few simple Cartesian Point to Point tests:

rtree.qbegin(bgi::nearest(Point(4, 4), 2))

and they were sorted in Boost 1.61.

Now I'd like a documentation or source quote to confirm it.

If not, I will just sort the query output myself afterwards.


1 Answers

[Note] In the case of iterative k-NN queries it is guaranteed to iterate over the closest Values first.

For K Nearest Neighbours boost::geometry guarantees to iterate over closest values first.

Source

like image 137
user3853544 Avatar answered Sep 28 '22 07:09

user3853544