I'm looking into writing an application that calculates the nearest POI's from a moving target (similar as application to indicate that one is nearing a speed camera).
I know I can calculate the distance with DistanceTo so basically what I could do is:
on every move (or a move of at least x meters): take the full list of POI's (might be a few thousand), calculate the current distance, sort them and take first one (= the POI that is most close)..
I would expect this is not something that can be done without any optimization: calculating and sorting distances of a few thousand locations each an every time ...
What would be the optimization that could be done ? Of course I can always only recalculate the distance to the previous POI's that were previously the nearest, but this approach would get incorrect the further I move from the original position.
Any idea's ?
Thanks
I know I can calculate the distance with DistanceTo so basically what I could do is:
on every move (or a move of at least x meters): take the full list of POI's (might be a few thousand), calculate the current distance, sort them and take first one (= the POI that is most close)..
I would expect this is not something that can be done without any optimization: calculating and sorting distances of a few thousand locations each an every time ...
What would be the optimization that could be done ? Of course I can always only recalculate the distance to the previous POI's that were previously the nearest, but this approach would get incorrect the further I move from the original position.
Any idea's ?
Thanks