Database Reference
In-Depth Information
Improving proximity filtering with KNN
- advanced
In the preceding recipe, we wanted to answer the simple question of which are the
nearest 10 locations to a given point, a simple question with a surprisingly sophist-
icatedanswer.Nowthatwehaveaddressedtheprecedingquestion,thequestionis
how do we approach this problem when we want to traverse an entire dataset and
test each record for its nearest neighbors?
Ourproblemisasfollows:foreachpointinourtable,weareinterestedintheangleto
thenearestobjectinanothertable.Acasedemonstratingthisscenarioisifwewant
torepresentaddresspointsasbuilding-likesquaresrotatedtoalignwithanadjacent
road, similar to the historic United States Geological Survey ( USGS ) quadrangle
maps, as shown in the following screenshot:
Search WWH ::




Custom Search