TL;DR: map matching works for cars, but I get “Encoded values do not match” when I try to map gpx tracks after importing with the --vehicle==“bike” flag. The “graphhopper config” have a different get_off_bike versions. This is using the most recent “recent_core” version on linux.
get_off_bike|version=-1500205055|bits=1|index=0|shift=24|store_both_directions=false
get_off_bike|version=2140540190|bits=1|index=0|shift=27|store_both_directions=false
full error:
(base) simon@ryzen:~/git/map-matching$ java -jar matching-web/target/graphhopper-map-matching-web-1.0-SNAPSHOT.jar match ~/git/snippets2/content/post/data/interim/*.gpx
loading graph from cache
java.lang.IllegalStateException: Encoded values do not match:
Graphhopper config: road_access|version=1732466967|bits=4|index=0|shift=0|store_both_directions=false,max_speed|version=925318033|bits=5|index=0|shift=4|store_both_directions=true,road_environment|version=-330907635|bits=3|index=0|shift=14|store_both_directions=false,road_class_link|version=150464194|bits=1|index=0|shift=17|store_both_directions=false,road_class|version=123992615|bits=5|index=0|shift=18|store_both_directions=false,roundabout|version=544120317|bits=1|index=0|shift=23|store_both_directions=false,get_off_bike|version=-1500205055|bits=1|index=0|shift=24|store_both_directions=false
Graph: road_access|version=1732466967|bits=4|index=0|shift=0|store_both_directions=false,max_speed|version=925318033|bits=5|index=0|shift=4|store_both_directions=true,road_environment|version=-330907635|bits=3|index=0|shift=14|store_both_directions=false,road_class_link|version=150464194|bits=1|index=0|shift=17|store_both_directions=false,road_class|version=123992615|bits=5|index=0|shift=18|store_both_directions=false,roundabout|version=544120317|bits=1|index=0|shift=23|store_both_directions=false,get_off_bike|version=2140540190|bits=1|index=0|shift=27|store_both_directions=false
Change configuration to match the graph or delete graph-cache/
at com.graphhopper.storage.GraphHopperStorage.loadExisting(GraphHopperStorage.java:255)
at com.graphhopper.GraphHopper.load(GraphHopper.java:780)
at com.graphhopper.matching.cli.MatchCommand.run(MatchCommand.java:70)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:93)
at com.graphhopper.matching.http.MapMatchingApplication.main(MapMatchingApplication.java:16)
details on map and tracks:
I have downloaded the OSM maps for the province of Quebec and 5000 bike trips in Montreal.
I have imported the OSM maps using the following command :
java -jar matching-web/target/graphhopper-map-matching-web-1.0-SNAPSHOT.jar import quebec-latest.osm.pbf --vehicle=“bike”
And I have used R to convert the first of the 5000 bike trips to GPX using the following commands:
trip5000 ← sf::read_sf(here::here(“content/post/data/downloads/trip5000.json”))
mls ← sf::st_cast(trip5000$geometry[[1]], “MULTIPOINT”)
z ← data.frame(id = “prout”, x = mls[,1], y = mls[,2])
pgirmess::writeGPX(z, filename = “original.gpx”, type = “t”)
I then matched the points to the map using this command:
java -jar matching-web/target/graphhopper-map-matching-web-1.0-SNAPSHOT.jar match original.gpx