Bytes_for_flags not considered


#1

I followed the instructions given at https://github.com/graphhopper/graphhopper/tree/master/reader-gtfs. After some difficulties withn the graphhopper.sh-script on my Windows-PC I decided to use InelliJ and compile and run directly from there. I used osm- and GTFS-data for Berlin.

However I get the following exception:

java.lang.IllegalArgumentException: Encoders are requesting 69 bits, more than 64 bits of edge flags. (Attempt to add EncodedValue car.average_speed) Decrease the number of vehicles or increase the flags to take long via graph.bytes_for_flags: 8
	at com.graphhopper.routing.util.EncodingManager.addEncodedValue(EncodingManager.java:350)
	at com.graphhopper.routing.util.EncodingManager.addEncoder(EncodingManager.java:329)
	at com.graphhopper.routing.util.EncodingManager.access$300(EncodingManager.java:45)
	at com.graphhopper.routing.util.EncodingManager$Builder.add(EncodingManager.java:213)
	at com.graphhopper.http.GraphHopperBundle.runPtGraphHopper(GraphHopperBundle.java:212)
	at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:202)
	at com.graphhopper.http.GraphHopperBundle.run(GraphHopperBundle.java:64)

I set the flag in both the config.yml and the VM-arguments to no avail.


#2

If you can upgrade, upgrade to 0.12. It was a limitation until 0.11 and is removed with 0.12. You can just save 64 bit in the FlagEncoder of additional edge information in EncodedValues until 0.12.


#3

Actually I´m on master.


#4

Okay. This shouldn’t happen @karussell, shouldn’t it if I understand your news to 0.12 correctly?

So sorry, I can’t help at the moment.


#5

We need to update the error message. You should be able to fix the problem via increasing the bytes further (in steps of 4):

graph.bytes_for_flags: 12

#6

This didn´t seem to change anything. So I tried to debug it and noticed that the value doesn´t seem to be evaluated by the encoders at all.

final EncodingManager encodingManager = new EncodingManager.Builder(8).add(ptFlagEncoder).add(new FootFlagEncoder()).add(new CarFlagEncoder()).build();

As far as I can see the configuration being passed to runPtGraphHopper isn´t used within the above line, making any setting within this configuration quite obsolete.


#7

Ah, ok. If you used the Java API without graphHopper.init() then no config is read.

Please try to replace the 8 with a 12:

new EncodingManager.Builder(8) -> new EncodingManager.Builder(12)


#8

That indeeed worked. However I wonder why there´s nothing on the tutorial about GTFS mentioned earlier. Or did I miss anything about graphHopper.init()?


#9

Usually there is no need to use the configuration file if you use the Java API or what do you mean?


#10

Ah okay, I see. But if we´d omit the config-yml completely, how would we ever configure more sophisticated options like the logger or the host? Is there any link for when to use a config-file?


#12

I am having a similar issue. can you please explain what you did to overcome. not an advance java user


#13

If you are using the graphhopper as a library then use any logging framework you like.

If you want to use the web module including dropwizard (incl. the server) then you create your own XYApplication class like GraphHopperApplication that uses GraphHopperBundle (that uses GraphHopperManaged that calls graphhopper.init that uses the config file).


#14

@Kohlroulade @karussell

Okay, slight misunderstanding here: You are running the server with configuration file, not the Java API, and you were quoting its source code, where the ‘8’ was hard-coded, and no value from the configuration file was used.

(Public transit uses an entry point different from the rest of GraphHopper.)

“Who would ever need more than 8 bytes…” – Me. Always worked for me with the Berlin file and even bigger ones.

Fixed on master. Works nicely now with


#15

Ups, thanks!