使用 GraphHopper 0.4.0,我无法在 turnCosts=true 的情况下启用 car + bike2 + foot 我系统地得到一个错误,我只能使用 2 种模式。
但是对于 GraphHopper 0.4.1 和 0.5 graphhopper-web-0.5-20150422.180133-28-bin 它甚至是值得的,无论车辆数量是多少,最终图表中根本没有考虑转弯限制,但仍然有第一个无论如何,超过2种模式都会出错。
那么,如何增加flags呢?
另外,如果一种方式被设置为私有,GraphHopper 将不会考虑 TAG 并在 0.4 或 0.5 中使用它。
配置文件
##### 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
日志
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