itinero/routing

Nearest neighbour (question)

bryanschoot opened this issue · 1 comments

When the routerDb is created and multiple poi are resolved onto the edges is it possible to find the nearest neighbour of a certain lng lat position.

The image below is an example of what I mean.

  • Orange dots are the poi;
  • Green line and text is the starting point
  • Red line and text is the nearest neighbor on the router network

Schermafbeelding 2021-06-08 205648

xivk commented

If I understand correctly you could calculate one-to-many with all the given points as targets.

It's also possible to let Itinero stop at the first location it finds, that's quite a bit of custom code, but very possible.

Have a look at how the many-to-many code works as a starting point. Basically, you could use a Dijkstra search starting at the starting point and have it stop at the first location it finds.