Find the right instruction after GPS fix lost using Graphhopper

206 Views Asked by At

I would like to create an app that shows the instructions to the user while traveling. The problem is that when you receive no positions for a while then probably the user went trough 2-3 instructions. After it when a new position arrives I would like to find the next instruction on the road.

What is the best way to find that instruction based on my position? Can Graphhopper help me to find it? Or should I recalculate the whole route in this case (from my position to destination)?

I tried locationIndex.findClosest() method but I don't know if it is the next or previous instruction.

Please give me some advices.

Thank you.

1

There are 1 best solutions below

5
On BEST ANSWER

Try:

ghResponse.getInstructionList().find(currentPosition.latitude, currentPosition.longitude)