graphhopper / map-matching

The map matching functionality is now located in the main repository https://github.com/graphhopper/graphhopper#map-matching
https://www.graphhopper.com/open-source/
Apache License 2.0
785 stars 274 forks source link

Sequence is broken for submitted track #166

Closed andrew-hardin closed 4 years ago

andrew-hardin commented 4 years ago

I received the following error while snapping a vehicle's route using a up-to-date copy of master:

java.lang.IllegalArgumentException: Sequence is broken for submitted track at time step 237 (1455 points).
observation:Observation{point=35.06446,-106.5506,0.0},
2 candidates: [
    distance: 5.372981769391219 to 35.06445915204511,-106.55054097424903,NaN,
    distance: 5.372981769391219 to 35.06445915204511,-106.55054097424903,NaN]. 
If a match is expected consider increasing max_visited_nodes.

Adjusting the max_visited_nodes parameter doesn't change behavior. Here's the track minimal track and OSM export that caused the error.

I'm happy to dig through the source with a debugger, but I'm unfamiliar with the domain (routing via HMM). Any suggestions of what to look for would be much appreciated.

braito4 commented 4 years ago

you should clean the gpx before do the matchmaking. Screenshot 2020-01-10 at 11 23 21

andrew-hardin commented 4 years ago

Thank you for the suggestion. I've pruned the track down to just 8 points that cause the error. Here's the new track file and the updated error message: bus_minimal_example.txt

java.lang.IllegalArgumentException: Sequence is broken for submitted track at time step 3 (8 points).
observation:Observation{point=35.06498,-106.5506,0.0},
3 candidates: [
        distance: 14.46840573628661 to 35.06509572413032,-106.55052732416677,NaN,
        distance: 6.387625781247086 to 35.0649789919093,-106.55052982726808,NaN,
        distance: 6.387625781247086 to 35.0649789919093,-106.55052982726808,NaN].
If a match is expected consider increasing max_visited_nodes.

preview

The updated track is plotted above. The vehicle is traveling from north to south along a road that splits temporarily into a pair of one-way streets at a security checkpoint. Any idea how to troubleshoot this?

braito4 commented 4 years ago

The problem is that open streetmap doesn't have mapped that road: Screenshot 2020-01-11 at 10 02 35 I added: Screenshot 2020-01-11 at 10 07 49 Try now yo can edit it here: https://www.openstreetmap.org/edit#map=20/35.06568/-106.55061

Be careful with the behavior of the gates/ford

Also, wait a day to download the new pbf; that's normally the time they need to update the map in the servers

andrew-hardin commented 4 years ago

I've downloaded the new pbf from OSM and the vehicle is being routed along the service road. That map edit resolves the initial problem, but I dug a little deeper because I wanted to understand why it wasn't routing along the one-way road.

The root cause ended up being the behavior of the gate on the south-bound lane. There was a GPS snap-point that was just south of the gate along the one-way road that couldn't be reached. This broke the Viterbi path.

I'll go ahead and close the issue - the broken sequence was caused by a problem with the OSM data and not the library. Thank you for your help, @braito4.