1

I have a problem with Graphhopper (ver. 0.6) method find() inside InstructionList class.

 public Instruction find(double lat, double lon, double maxDistance )

It returns me next instruction even when a distance (between current location and next turn) is much longer than I specify in maxDistance. But it should return null. How does exactly it works?

EDIT: Here is sample map (dots are instruction's points; coordinates are returned by getPoints(); each color for another instruction)

enter image description here

At point 1. using find() method I get instruction two (turn right onto Rosenweg), even if maxDistance is very small, for example 5m.

After turning right (point 2.) I get immediately instruction 3 name and at 3. point I get finish. Is it normal?

Derek K
  • 2,756
  • 1
  • 21
  • 37
  • 1
    This does not seem right. What is your exact example e.g. provide a route link to GraphHopper Maps and the lat&lon you use for lookup? Also here is the source for how it currently works: https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/util/InstructionList.java#L306 there are always possible improvements for sure. – Karussell Nov 16 '15 at 07:18
  • Thanks for reply, I edited answer and added sample map. I looked through the code but I don't understand everything. – Derek K Nov 16 '15 at 14:11
  • 1
    Hmmh, maybe a misunderstanding or poorly docs? You want to decide when to display the next instruction, for that you need the current ones and right after turning also the next instruction. Also `maxDistance` is the distance to the route not the turning point. Or what would be expected behaviour? – Karussell Nov 16 '15 at 16:52
  • Ok. Thank you. I didn't know that maxDistance is a distance to the route. Now it's clear. PS I think it is an amazing project and I hope for better documentation. – Derek K Nov 16 '15 at 18:06
  • Thanks! And just edit the file or documentation on github and provide the necessary changes as pull request to improve it :) – Karussell Nov 17 '15 at 08:20

1 Answers1

1

To formulate an answer: this was a misunderstanding and/or poorly documentation - we need to improve there too :)

The find method is for the case when you want to decide when to display the next instruction, for that you need the current ones and right after turning also the next instruction. And maxDistance is the distance to the route not the turning point.

Karussell
  • 17,085
  • 16
  • 97
  • 197