Hello everyone,
I would like to do the following with Graphhopper:
Find a way from A to B, with as MANY unpaved roads as possible, which are allowed to be used by cars, or more precisely by motorcycles (It is OK to do detours for that). Why the hell would i like to do that? Well, I have an adventure bike / dual sport motorcycle and I (and also many others) really enjoy riding it on dirt roads (like the one in the picture).
This is what I found out:
Using Custom Models, I can prefer roads with a certain surface or track type (which indirectly suggests the surface). See code below:
profiles:
- name: adv_bike
vehicle: car
weighting: customv
"custom_model": {
"priority": [
# lookup track_type because some dirt-road tracks/roads don't have surface tag but DO have track_typed defined. track_type 2-5 suggest that it is a dirt/gravel-road
{
"if": "!(surface == GRAVEL || surface == UNPAVED || surface == FINE_GRAVEL || surface == COMPACTED || surface == GROUND || surface == DIRT || surface == GRASS || surface == SAND || track_type == GRADE2 || track_type == GRADE3 || track_type == GRADE4 || track_type == GRADE5)",
"multiply_by": "0.01"
}
],
distance_influence: 1
}
BUT:
I use the Car Model as a base (e.g. because I only want to drive on roads that I am allowed to drive on with car/motorbike - and because the speeds are realistic). but the Car Model cannot use Tracktype 4&5. My current temporary solution is to change the CarTagParser so that I can use roads with tracktype 4&5 (see code snippet from CarTagParser below - last 2 lines of code added).
trackTypeSpeedMap.put("grade1", 20); // paved
trackTypeSpeedMap.put("grade2", 15); // now unpaved - gravel mixed with ...
trackTypeSpeedMap.put("grade3", 10); // ... hard and soft materials
trackTypeSpeedMap.put("grade4", 10); // ... some hard or compressed materials
trackTypeSpeedMap.put("grade5", 10); // ... no hard materials. soil/sand/grass
trackTypeSpeedMap.put(null, defaultSpeedMap.get("track"));
Now to the actual questions:
Question 1 are roads with certain surface or tracktype disfavored by default in the Car model? And if so, where is this done?
Question 2: is it possible to change the CarTagParser in a way so that you can allow track types 4&5 in the custom model? If no → Question 3: does it make sense to add an additional offroad-carflagencoder to Graphhopper?
Or am I completely on the wrong track and there is a much better approach to implement my request?