Config.properties won't take graph.flag_encoders=car,foot

Localhost:8989 works perfectly for car routing (except I am trying to slow the timings down, but I’ve not got that far in yet).

At the moment, I’m trying to adjust the config file as follows, just to add foot and bike routes.

# Possible options: car,foot,bike,bike2,mtb,racingbike,motorcycle (comma separated)
# bike2 takes elevation data into account (like up-hill is slower than down-hill) 
graph.flag_encoders=car, foot

I get the following error messages.

INFO: An exception was caught and reported. Message: java.lang.IllegalStateException: Encoding does not match:
Graphhopper config: car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=1,foot|speed_factor=1.0|speed_bits=4|turn_costs=false|version=2
Graph: car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=1, dir:devon-latest.osm-gh/
java.lang.IllegalStateException: Couldn't load graph
	at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:76)
	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.http.GHServer$1.configure(GHServer.java:119)
	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.http.GHServer.main(GHServer.java:55)
Caused by: java.lang.IllegalStateException: Encoding does not match:
Graphhopper config: car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=1,foot|speed_factor=1.0|speed_bits=4|turn_costs=false|version=2
Graph: car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=1, dir:devon-latest.osm-gh/
	at com.graphhopper.storage.GraphHopperStorage.loadExisting(GraphHopperStorage.java:235)
	at com.graphhopper.GraphHopper.load(GraphHopper.java:801)
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:657)
	at com.graphhopper.http.DefaultModule.createGraphHopper(DefaultModule.java:53)
	at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:64)
	... 14 more

Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Explicit bindings are required and java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed) is not explicitly bound.
  while locating java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed)
    for field at com.graphhopper.http.GHBaseServlet.jsonpAllowed(GHBaseServlet.java:41)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:60) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

2) Explicit bindings are required and java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed) is not explicitly bound.
  while locating java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed)
    for field at com.graphhopper.http.GHBaseServlet.jsonpAllowed(GHBaseServlet.java:41)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:63) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

3) Explicit bindings are required and java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed) is not explicitly bound.
  while locating java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed)
    for field at com.graphhopper.http.GHBaseServlet.jsonpAllowed(GHBaseServlet.java:41)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:66) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

4) Explicit bindings are required and java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed) is not explicitly bound.
  while locating java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonp_allowed)
    for field at com.graphhopper.http.GHBaseServlet.jsonpAllowed(GHBaseServlet.java:41)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:69) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

5) An exception was caught and reported. Message: Couldn't load graph
  at com.graphhopper.http.GHServer$1.configure(GHServer.java:119) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.DefaultModule)

6) Explicit bindings are required and com.graphhopper.GraphHopper is not explicitly bound.
  while locating com.graphhopper.GraphHopper
    for field at com.graphhopper.http.GraphHopperServlet.hopper(GraphHopperServlet.java:57)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:66) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

7) Explicit bindings are required and com.graphhopper.http.RouteSerializer is not explicitly bound.
  while locating com.graphhopper.http.RouteSerializer
    for field at com.graphhopper.http.GraphHopperServlet.routeSerializer(GraphHopperServlet.java:57)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:66) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

8) Explicit bindings are required and com.graphhopper.util.TranslationMap is not explicitly bound.
  while locating com.graphhopper.util.TranslationMap
    for field at com.graphhopper.http.I18NServlet.map(I18NServlet.java:35)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:60) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

9) Explicit bindings are required and com.graphhopper.GraphHopper is not explicitly bound.
  while locating com.graphhopper.GraphHopper
    for field at com.graphhopper.http.InfoServlet.hopper(InfoServlet.java:38)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:63) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

10) Explicit bindings are required and com.graphhopper.GraphHopper is not explicitly bound.
  while locating com.graphhopper.GraphHopper
    for field at com.graphhopper.http.NearestServlet.hopper(NearestServlet.java:40)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:69) (via modules: com.graphhopper.http.GHServer$1 -> com.graphhopper.http.GHServletModule)

10 errors
	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
	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.http.GHServer.main(GHServer.java:55)
Caused by: java.lang.IllegalStateException: Couldn't load graph
	at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:76)
	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.http.GHServer$1.configure(GHServer.java:119)
	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)
	... 5 more
Caused by: java.lang.IllegalStateException: Encoding does not match:
Graphhopper config: car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=1,foot|speed_factor=1.0|speed_bits=4|turn_costs=false|version=2
Graph: car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=1, dir:devon-latest.osm-gh/
	at com.graphhopper.storage.GraphHopperStorage.loadExisting(GraphHopperStorage.java:235)
	at com.graphhopper.GraphHopper.load(GraphHopper.java:801)
	at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:657)
	at com.graphhopper.http.DefaultModule.createGraphHopper(DefaultModule.java:53)
	at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:64)
	... 14 more
1 Like

You probaly need to delete your graph and build it anew.

1 Like

Yes, thank you! Now works perfectly

Why doesn’t graphhopper.sh do this itself? It seems that if the script can handle the case where the graph is not loaded yet, it should be capable of recreating the graph if needed. Instead it throws an exception and it is not easy to figure out, what’s happening.

We would have to detect the config change somehow and not all config changes should result in resource intense cache recreation.

What do you mean delete your graph and build it anew? I have the exact same problem described here, and am new at this… Please walk through the solution more clearly.

This thread is quite old :slight_smile: What did you do when you got the error? Deleting the graph means deleting the devon-latest.osm-gh (or whatevername-gh) folder from disk. The next time graphhopper is running it will be created again (but this might take some time depending on the size of map you are using)