I have a roads data set (in osm.pbf format) with the average driving speed for each road segment. What would be the best way to specify that GraphHopper should use these speeds for routing and not default speeds per road type? The average driving speed for each road segment is stored as “maxspeed” in a “other_tags” field in my osm.pbf file.
You should adjust one of the existing or write your own FlagEncoder that does this. The most important methods are getAccess(ReaderWay) where you specify whether or not an OSM way should be considered accessible for your vehicles and handleWayTags where you should read your maxspeed tag and set the speed and access flags (take a look at AbstractFlagEncoder to see how this works).
If I adjust the CarFlagEncoder, would the following work?
In the getAccess(ReaderWay) method as shown below, would I supplement “highway” with “other_tags” or would you recommend I add an additional If statement for “other_tags”?
However, I am getting this error. It seems “other_tags” is being accessed, but not “maxspeed” in “other_tags”. I have not changed anything by the getAccess(ReaderWay) and handleWayTags methods yet.