Encoded values do not match (for bike map matching)

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

Thanks for reporting. This should be fixed in master, see https://github.com/graphhopper/graphhopper/pull/1876

thanks for your quick reply (and the tool!)

I tried pulling the repo at master and building. I get the following error, which is different from the one I used to get with “recent-core”.

EDIT: The master for graphhopper/ map-patching is 5 days old. Is this an issue, or is the fix only in graphhopper/graphhopper ?

java -jar matching-web/target/graphhopper-map-matching-web-1.0-SNAPSHOT.jar import …/map-matching-bak/quebec-latest.osm.pbf --vehicle=“bike”

(base) simon@ryzen:~/git/map-matching$ java -jar matching-web/target/graphhopper-map-matching-web-1.0-SNAPSHOT.jar match /home/simon/git/snippets2/content/post/original.gpx
loading graph from cache
java.lang.IllegalArgumentException: Encoder for car not found. Existing: bike|speed_factor=2.0|speed_bits=4|turn_costs=false|version=2
at com.graphhopper.routing.util.EncodingManager.getEncoder(EncodingManager.java:394)
at com.graphhopper.routing.util.EncodingManager.getEncoder(EncodingManager.java:385)
at com.graphhopper.matching.MapMatching.(MapMatching.java:104)
at com.graphhopper.matching.cli.MatchCommand.run(MatchCommand.java:83)
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)

EDIT2 : I tried pulling map-matching “recent_core” and I get an error in the import phase rather than the match phase:

(base) simon@ryzen:~/git/map-matching$ java -jar matching-web/target/graphhopper-map-matching-web-1.0-SNAPSHOT.jar import …/map-matching-bak/quebec-latest.osm.pbf --vehicle=“bike”
java.lang.IllegalArgumentException: entry in encoder list not supported “bike”
at com.graphhopper.routing.util.DefaultFlagEncoderFactory.createFlagEncoder(DefaultFlagEncoderFactory.java:60)
at com.graphhopper.routing.util.EncodingManager.parseEncoderString(EncodingManager.java:388)
at com.graphhopper.routing.util.EncodingManager$Builder.addAll(EncodingManager.java:190)
at com.graphhopper.GraphHopper.init(GraphHopper.java:527)
at com.graphhopper.matching.cli.ImportCommand.run(ImportCommand.java:35)
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)