abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
473 stars 113 forks source link

Last message in the block of messages references non-existing point in geometry. (Output in geojson format). #657

Closed radim-asamm closed 3 months ago

radim-asamm commented 6 months ago

If we look at this sample request, we see that all messages reference points (nodes) of the attached geometry via latitude, longitude (after conversion from integer to floating point data type). Except for the very last one message. This seems to be always the case. This is unexpected. If I insert print commands in function aggregateMessages() of OsmTrack like this:

    for (OsmPathElement n : nodes) {
      System.out.println("node: lon: " + n.getILon() + ", lat: " + n.getILat());
      System.out.println("message: lon: " + n.message.lon + ", lat: " + n.message.lat);

I see:

node: lon: 193553890, lat: 139995910
message: lon: 0, lat: 0 // expected, messages "look backwards"
node: lon: 193553348, lat: 139995852
message: lon: 193553348, lat: 139995852
...
// many more messages where node coordinates match message coordinates
...
// very last message, mismatch
node: lon: 193562059, lat: 139224329
message: lon: 193562430, lat: 139224152

So the last message does not match its node. When I dig deeper I see that coordinates of messages are manipulated in the function addAddionalPenalty of OsmPath but that manipulation is very complex to read for me. I appreciate any insight into this, so I can at least try to PR this. Many thanks.

afischerdev commented 4 months ago

Sorry for the delay. In fact a bit irritating when the last point isn't found in track. I didn't found a special reason for that, at the end I controlled the locations before it generates messages. Now the last message is equal to the last point in track.