Closed hoogw closed 4 years ago
So if you wan to limit the return size of search result, You should not do limit in rbush core function( because you will failed for ever)
You should do limit out side of rbush core function.
Right, thanks for the insight!
related to #106 I found a solution. That is do not modify the rbush core function, Do not add limit to tree.search(bbox, limit)
I try to add limit to tree.search(bbox, limit) always failed, because it always result in centralized, clustered result. which is not geographically even distribute. see screen shot at #106
I found in fact there is NO WAY to do so, you work around out side rbush core function.
rbush and rtree are same concept when do intersect, it start from top root level, drill down, until drill down to bottom level leaf, then starting collect result, There is NO Way at bottom level you make limit count result while keep geographically even distribution. It always collect 1 leaf(9 count) and then collect another leaf(9 count) and so on
The work around is you let rbush collect all result. Then you pick mathmatically evenly( in terms of geographic evenly). You mathmatic evenly pick results against limit count, in fact, the picked result reflect geographically evenly. The denser point area, the more picked points in that area. The less point area, the less picked point fall in that area, magic.
This is how you are going to mathmatically pick. for example, you have 100 result, but you only want pick 10. if you pick 0,1, 2, 3, ...9, those will geographically clustered, centralized, we do not want that. You should pick 0, 10, 20, ....100, steps by 10. those point will magically geographic distribute evenly.
`
`
This is result I use rbush , select limit 500 out of 150k point, successfully make it geographically evenly distribute