Hi @mbenkert ,
there are a few posts that deal with in a bit more detail this e.g.:
In order to better control speed limits and other routing prioritization I had to create my own FlagEncoder called MyHeavyVehicleFlagEncoder (a copy of HeavyVehicleFlagEncoder for the moment until restrictions work) and added a new DRIVING_MYHGV constant in RoutingProfileType (value of 77 not used before). I also adapted the code so the generation produces the graph folders.
Until here everything looks great and i was able to have two directory in my graphs folder after the generation is done: …
If you run your own, you will be fine with adjusting existing values.
for hiking sac scale adjust:
/*
* This file is part of Openrouteservice.
*
* Openrouteservice is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library;
* if not, see <https://www.gnu.org/licenses/>.
*/
package org.heigit.ors.routing.graphhopper.extensions.flagencoders;
import com.graphhopper.util.PMap;
import java.util.Arrays;
This file has been truncated. show original
for cycling regular or mtb (both extend CommonBikeFlagencoder): e.g.
return acceptPotentially;
}
return EncodingManager.Access.CAN_SKIP;
}
if (!highwaySpeeds.containsKey(highwayValue)) {
return EncodingManager.Access.CAN_SKIP;
}
String sacScale = way.getTag("sac_scale");
if (sacScale != null) {
if ((way.hasTag(KEY_HIGHWAY, KEY_CYCLEWAY)) && (way.hasTag("sac_scale", "hiking"))) {
return EncodingManager.Access.WAY;
}
if (!isSacScaleAllowed(sacScale)) {
return EncodingManager.Access.CAN_SKIP;
}
}
// use the way if it is tagged for bikes
if ("grade1".equals(trackType))
weightToPrioMap.put(50d, UNCHANGED.getValue());
else if (trackType == null)
weightToPrioMap.put(90d, PREFER.getValue());
else if (trackType.startsWith("grade"))
weightToPrioMap.put(100d, VERY_NICE.getValue());
}
}
@Override
boolean isSacScaleAllowed(String sacScale) {
// other scales are too dangerous even for MTB, see http://wiki.openstreetmap.org/wiki/Key:sac_scale
return "hiking".equals(sacScale) || "mountain_hiking".equals(sacScale)
|| "demanding_mountain_hiking".equals(sacScale) || "alpine_hiking".equals(sacScale);
}
@Override
public String toString() {
return FlagEncoderNames.MTB_ORS;
}
which waytypes are usable is definde in the getAccess method in those files.
This is evaluated during graph build though.
So if you change something don’t forget to rebuild the graphs (best just remove the existing ones)
Best regards
2 Likes