Will truck speed profiles be added to core?

Hi, I was wondering if you planned to add the truck profiles listed here https://github.com/graphhopper/directions-api/blob/master/supported-vehicle-profiles.md to the open source Graphhopper core?

Currently I believe I’d have to subclass or create a modified version of the CarFlagEncoder to add truck speeds to Graphhopper; looking for an easier solution : )


Hi Phil,

good question :slight_smile: ! We’ve decided to keep them closed source for now, as these are very specific needs although we see the generic application as e.g. the creation is relative powerful mechanism:

public static final TruckFlagEncoder createSmallTruck(String name) {
    return new TruckFlagEncoder().setName(name).
            setHeight(2.7).setWidth(2, 0.4).setLength(5.5).
            setWeight(2080, 2080 + 1400).

In general this is not really a big task to implement this with a bit of GraphHopper knowledge, but the specific things in OSM can get VERY ugly: https://www.openstreetmap.org/user/karussell/diary/36220

Of course, in the next months we’ll make creating such new profiles a lot easier without the need to understand or workaround the underlying OSM structure. See the related post: More flexibility in GraphHopper

Hi Peter - thanks for your reply. I see your point re: difficulty in interpreting OSM specifics; things can get quite ugly with all the different tag formats. Probably when / if I need a truck encoder I’ll just base it on the Car Flag encoder but enforce a maximum speed. I’m not convinced that the height / weight restrictions (e.g. low bridge etc) will be accurate enough in OSM data to justify that level of modelling anyway - at least for route optimisation. I look forward to the developments in making profiles easier - keep up the good work : )

Hy, are there some updates concerning truck flag encoder for the open source version? As you mentioned above you decided to keep them closed source for now (january 2016).

Kind of, yes. See https://github.com/graphhopper/graphhopper/pull/936 and https://github.com/graphhopper/graphhopper/pull/1112

Hi, I don’t really understand how this makes using a truck profile possible.
Can you explain?

With the latest work: https://github.com/graphhopper/graphhopper/pull/1447 you can define several attributes per edge much easier and use them for a restriction. E.g. see this discussion where this pull request is further enhanced and provides simple configuration options via JSON or scripting: Flexible Vehicle Profiles