Starting local map-matching server with several jars

According to official repo to build .jar file we need to run mvn package -DskipTests in the console. But as a result we are given 4 different jars:

hmm-lib-1.0.0.jar
graphhopper-map-matching-core-0.8.2.jar
graphhopper-map-matching-web-0.8.2.jar
graphhopper-map-matching-web-0.8.2-jar-with-dependencies.jar

(Note I use 0.8 branch because of building problems on master)

In repo readme file we can find the step to import osm.pbf file into service:

java -jar matching-web/target/graphhopper-map-matching-web-3.0-SNAPSHOT.jar import map-data/leipzig_germany.osm.pbf

I assume (please tell me if I’m wrong) that jar which I need to use for that step (and to run matching service)
is graphhopper-map-matching-web-0.8.2-jar-with-dependencies.jar

I ask, because during importing osm.pbf file I faced an error

Jan 20, 2021 2:08:19 AM com.google.inject.internal.MessageProcessor visit
INFO: An exception was caught and reported. Message: java.lang.IllegalArgumentException: You need to specify an OSM file.
java.lang.IllegalStateException: Couldn't load graph
        at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:78)
        at com.graphhopper.matching.http.MatchDefaultModule.configure(MatchDefaultModule.java:38)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
        at com.google.inject.AbstractModule.install(AbstractModule.java:122)
        at com.graphhopper.matching.http.MatchServer$1.configure(MatchServer.java:51)
        at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
        at com.google.inject.spi.Elements.getElements(Elements.java:110)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
        at com.google.inject.Guice.createInjector(Guice.java:96)
        at com.google.inject.Guice.createInjector(Guice.java:73)
        at com.google.inject.Guice.createInjector(Guice.java:62)
        at com.graphhopper.http.GHServer.start(GHServer.java:59)
        at com.graphhopper.matching.http.MatchServer.main(MatchServer.java:35)
Caused by: java.lang.IllegalArgumentException: You need to specify an OSM file.
        at com.graphhopper.GraphHopper.init(GraphHopper.java:563)
        at com.graphhopper.http.DefaultModule.createGraphHopper(DefaultModule.java:52)
        at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:64)
        ... 15 more

I’m sure I’m doing something pretty wrong but have no idea what.

You should use the recent_core branch with version 2.0.

Another simpler solution is to use the latest branch in graphhopper/graphhopper where map-matching is now integrated.

Powered by Discourse