SOLVED Encoders are requesting 34 bits, more than 32 bits of edge flags. (Attempt to add EncodedValue bike-waytype) Decrease the number of vehicles or increase the flags to more bytes via graph.bytes_for_flags

EDIT: solved using the developper quickstart guide, see below.
hey everyone,

I am trying my luck with the routing engine and it’s looking great (for cars!).

I get an error when I try to encode with bikes. Here is what I have done to follow the guide at https://github.com/graphhopper/graphhopper/blob/0.13/docs/web/quickstart.md

mkdir graphhopper
cd graphhopper
wget https://raw.githubusercontent.com/graphhopper/graphhopper/0.13/config-example.yml
cat config-example.yml | sed s/“graph.flag_encoders: car”/“graph.flag_encoders: bike”/ > config-bike.yml
wget https://graphhopper.com/public/releases/graphhopper-web-0.13.0.jar
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
java -Dgraphhopper.datareader.file=berlin-latest.osm.pbf -jar *.jar server config-bike.yml

and here is the error I get:

2020-02-26 12:28:29.821 [main] INFO i.d.server.DefaultServerFactory - Registering jersey handler with root path prefix: /
2020-02-26 12:28:29.823 [main] INFO i.d.server.DefaultServerFactory - Registering admin handler with root path prefix: /
java.lang.IllegalArgumentException: Encoders are requesting 34 bits, more than 32 bits of edge flags. (Attempt to add EncodedValue bike-waytype) Decrease the number of vehicles or increase the flags to more bytes via graph.bytes_for_flags: 8
at com.graphhopper.routing.util.EncodingManager.addEncodedValue(EncodingManager.java:405)
at com.graphhopper.routing.util.EncodingManager.addEncoder(EncodingManager.java:377)
at com.graphhopper.routing.util.EncodingManager.access$600(EncodingManager.java:49)
at com.graphhopper.routing.util.EncodingManager$Builder.add(EncodingManager.java:225)
at com.graphhopper.routing.util.EncodingManager$Builder.addAll(EncodingManager.java:208)
at com.graphhopper.GraphHopper.init(GraphHopper.java:523)
at com.graphhopper.http.GraphHopperManaged.(GraphHopperManaged.java:69)
at com.graphhopper.http.GraphHopperBundle.runRegularGraphHopper(GraphHopperBundle.java:264)
at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:205)
at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:62)
at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
at io.dropwizard.cli.Cli.run(Cli.java:78)
at io.dropwizard.Application.run(Application.java:93)
at com.graphhopper.http.GraphHopperApplication.main(GraphHopperApplication.java:34)

using cars I have no problem:

(base) simon@ryzen:~/graphhopper$ java -Dgraphhopper.datareader.file=berlin-latest.osm.pbf -jar .jar server config-example.yml
2020-02-26 12:30:56.742 [main] INFO i.d.server.DefaultServerFactory - Registering jersey handler with root path prefix: /
2020-02-26 12:30:56.744 [main] INFO i.d.server.DefaultServerFactory - Registering admin handler with root path prefix: /
2020-02-26 12:30:57.128 [main] INFO i.d.b.assets.ConfiguredAssetsBundle - Registering ConfiguredAssetBundle with name: assets for path /maps/

2020-02-26 12:30:57.134 [main] INFO io.dropwizard.server.ServerFactory - Starting GraphHopperApplication
_ _
__ _ _ __ __ _ _ __ | |__ | |__ ___ _ __ _ __ ___ _ __
/ | '__/ _ | ’ | '_ | '_ \ / _ | '_ | '_ \ / _ \ '|
| (| | | | (| | |) | | | | | | | () | |) | |) | / |
_, || _,| .
/|| ||| ||_
/| ./| ./ _||
|
/ || || |_|

2020-02-26 12:30:57.180 [main] INFO o.e.jetty.setuid.SetUIDListener - Opened application@c2cf597{HTTP/1.1,[http/1.1]}{localhost:8989}
2020-02-26 12:30:57.180 [main] INFO o.e.jetty.setuid.SetUIDListener - Opened admin@724bf25f{HTTP/1.1,[http/1.1]}{localhost:8990}
2020-02-26 12:30:57.181 [main] INFO org.eclipse.jetty.server.Server - jetty-9.4.z-SNAPSHOT; built: 2019-04-29T20:42:08.989Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 11.0.3+7-Ubuntu-1ubuntu218.10.1
2020-02-26 12:30:57.200 [main] INFO c.g.reader.osm.GraphHopperOSM - version 0.13.0|2019-09-17T21:00:20Z (5,15,4,3,3,5)
2020-02-26 12:30:57.202 [main] INFO c.g.reader.osm.GraphHopperOSM - graph CH|car|RAM_STORE|2D|NoExt|, details:edges:0(0MB), nodes:0(0MB), name:(0MB), geo:0(0MB), bounds:1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308, CHGraph|fastest|car|edge_based=false|u_turn_costs=-1, shortcuts:0, nodesCH:(0MB)
2020-02-26 12:30:57.215 [main] INFO c.g.reader.osm.GraphHopperOSM - start creating graph from berlin-latest.osm.pbf
2020-02-26 12:30:57.216 [main] INFO c.g.reader.osm.GraphHopperOSM - using CH|car|RAM_STORE|2D|NoExt|, memory:totalMB:508, usedMB:36
2020-02-26 12:31:00.390 [main] INFO com.graphhopper.reader.osm.OSMReader - creating graph. Found nodes (pillar+tower):264 833, totalMB:918, usedMB:409

EDIT: here is how it works using the developer quick start guide (https://github.com/graphhopper/graphhopper/blob/0.13/docs/core/quickstart-from-source.md)

I edited the config-example to include car and bike. FOr some reason the program complains when I don’t put “car” anywhere.

my config-example.yml : https://gist.github.com/SimonCoulombe/c4e4bb3af45ba6b4ccdd48aab561b2dc

git clone git://github.com/graphhopper/graphhopper.git
cd graphhopper;
cd web/src/main/resources/ && ZFILE=/tmp/gh.jar && wget -O $ZFILE “https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.graphhopper&a=graphhopper-web&v=LATEST” && unzip $ZFILE assets/js/main.js && rm $ZFILE && cd …/…/…/…
wget http://download.geofabrik.de/north-america/canada/quebec-latest.osm.pbf
./graphhopper.sh -a web -i quebec-latest.osm.pbf -c config-example.yml

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Powered by Discourse