1

With GraphHopper 0.4.0, I cannot enable car + bike2 + foot with turnCosts=true I systematically get an error, I can only use 2 modes.

But with GraphHopper 0.4.1 and 0.5 graphhopper-web-0.5-20150422.180133-28-bin it’s even worth, the turn restrictions are just not taken at all in consideration in the final graph whatever the number of vehicles is, but still have the first error anyway with more than 2 modes.

So, how to increase the flags?

Plus, if a way is set as private, GraphHopper will not consider the TAG and use it anyway in both 0.4 or 0.5.

Config file

##### Vehicles #####
#
# 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)
# and requires enabling graph.elevation.provider below
graph.flagEncoders=bike2,foot

# Enable turn restrictions for car or motorcycle. 
# Currently you need to additionally set prepare.chWeighting=no before using this (see below and #270)
graph.flagEncoders=foot,bike2|turnCosts=true

#osmreader.bytesForFlags=8
#osmreader.acceptWay=car,bike,foot


##### Elevation #####
#
# To populate your graph with elevation data use SRTM, default is noop
graph.elevation.provider=srtm
#
# default location for cache is /tmp/srtm
# graph.elevation.cachedir=./srtmprovider/
#
# If you have a slow disk or plenty of RAM change the default MMAP to:
# graph.elevation.dataaccess=RAM_STORE



##### Storage #####
#
# configure the memory access, use RAM_STORE for well equipped servers, 
# MMAP_STORE_SYNC could be used otherwise but will be a lot slower
graph.dataaccess=RAM_STORE

# if you want to reduce storage size and you don't need instructions for the resulting path use:
# osmreader.instructions=false
osmreader.wayPointMaxDistance=1


#### Speed-up Mode vs. Flexibility Mode ####
#
# By default the speed-up mode with the 'fastest' weighting is used. Internally a graph preparation via
# contraction hierarchies is done to speed routing up. This requires more RAM/disc space for holding the
# graph but less for every request. Also only the first vehicle of the flagEncoders list will be prepared.
# prepare.chWeighting=fastest
#
# Disable the speed-up mode (contraction hierarchies, CH) via enabling the flexibility mode:
prepare.chWeighting=no


##### Web #####
# if you want to support jsonp response type you need to add it explicitely here. By default it is disabled for 
# stronger security.
web.jsonpAllowed=true

Log

com.google.inject.internal.MessageProcessor visit
INFOS: An exception was caught and reported. Message: java.lang.IllegalArgumentException: Encoders are requesting more than 32 bits of way flags. Decrease the number of vehicles or increase the flags to take long.
java.lang.IllegalStateException: Couldn't load graph
    at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:82)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.AbstractModule.install(AbstractModule.java:118)
    at com.graphhopper.http.GHServer$1.configure(GHServer.java:114)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.spi.Elements.getElements(Elements.java:101)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.graphhopper.http.GHServer.start(GHServer.java:62)
    at com.graphhopper.http.GHServer.main(GHServer.java:48)
Caused by: java.lang.IllegalArgumentException: Encoders are requesting more than 32 bits of way flags. Decrease the number of vehicles or increase the flags to take long.
    at com.graphhopper.routing.util.EncodingManager.registerEncoder(EncodingManager.java:183)
    at com.graphhopper.routing.util.EncodingManager.<init>(EncodingManager.java:106)
    at com.graphhopper.routing.util.EncodingManager.<init>(EncodingManager.java:75)
    at com.graphhopper.GraphHopper.init(GraphHopper.java:574)
    at com.graphhopper.http.DefaultModule.createGraphHopper(DefaultModule.java:55)
    at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:69)
    ... 14 more

Exception in thread "main" com.google.inject.CreationException: Guice creation errors:

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

2) Explicit bindings are required and java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonpAllowed) is not explicitly bound.
  while locating java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonpAllowed)
    for field at com.graphhopper.http.GHBaseServlet.jsonpAllowed(GHBaseServlet.java:35)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:63)

3) Explicit bindings are required and java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonpAllowed) is not explicitly bound.
  while locating java.lang.Boolean annotated with @com.google.inject.name.Named(value=jsonpAllowed)
    for field at com.graphhopper.http.GHBaseServlet.jsonpAllowed(GHBaseServlet.java:35)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:66)

4) An exception was caught and reported. Message: Couldn't load graph
  at com.graphhopper.http.GHServer$1.configure(GHServer.java:114)

5) 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:55)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:66)

6) 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)

7) 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:39)
  at com.graphhopper.http.GHServletModule.configureServlets(GHServletModule.java:63)

7 errors
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at com.graphhopper.http.GHServer.start(GHServer.java:62)
    at com.graphhopper.http.GHServer.main(GHServer.java:48)
Caused by: java.lang.IllegalStateException: Couldn't load graph
    at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:82)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.AbstractModule.install(AbstractModule.java:118)
    at com.graphhopper.http.GHServer$1.configure(GHServer.java:114)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
    at com.google.inject.spi.Elements.getElements(Elements.java:101)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    ... 5 more
Caused by: java.lang.IllegalArgumentException: Encoders are requesting more than 32 bits of way flags. Decrease the number of vehicles or increase the flags to take long.
    at com.graphhopper.routing.util.EncodingManager.registerEncoder(EncodingManager.java:183)
    at com.graphhopper.routing.util.EncodingManager.<init>(EncodingManager.java:106)
    at com.graphhopper.routing.util.EncodingManager.<init>(EncodingManager.java:75)
    at com.graphhopper.GraphHopper.init(GraphHopper.java:574)
    at com.graphhopper.http.DefaultModule.createGraphHopper(DefaultModule.java:55)
    at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:69)
    ... 14 more
M-Rick
  • 141
  • 3

1 Answers1

0

Turn restrictions will work e.g. for car if you disable CH prepare.chWeighting=no

The IllegalArgumentException means that you should decrease the used space or increase the available space, but the error message should be improved on how to do so:

osmreader.bytesForFlags=8

Fixed via this commit. (BTW: the differences of the versions come due to the fact that we need more bits in more recent versions)

Now regarding:

Plus, if a way is set as private, GraphHopper will not consider the TAG and use it anyway in both 0.4 or 0.5

We exclude other tags successfully so I bet against a bug :). Maybe you tell us what you did exactly

Karussell
  • 17,085
  • 16
  • 97
  • 197
  • Ok so you are already aware about all of this. Great news. What about the turns restrictions? – M-Rick May 11 '15 at 19:22
  • Did you tried it again and did not get an error? Turn restrictions should work for car and bike if you disable CH (prepare.chWeighting=no) – Karussell May 12 '15 at 07:57