finer-grained road access

This commit is contained in:
vcoppe
2026-01-18 15:23:39 +01:00
parent c91baf7c83
commit a01ca79a82

View File

@@ -53,6 +53,57 @@ const mtbRatingToScale: { [key: string]: string } = {
'6': '5', '6': '5',
'7': '6', '7': '6',
}; };
const graphhopperBlockPrivateCustomModels: { [key: string]: any } = {
bike: {
priority: [
{
if: 'bike_road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
racingbike: {
priority: [
{
if: 'bike_road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
gravelbike: {
priority: [
{
if: 'bike_road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
mtb: {
priority: [
{
if: 'bike_road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
foot: {
priority: [
{
if: 'foot_road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
motorcycle: {
priority: [
{
if: 'road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
};
async function getGraphHopperRoute( async function getGraphHopperRoute(
points: Coordinates[], points: Coordinates[],
graphHopperProfile: string, graphHopperProfile: string,
@@ -71,14 +122,7 @@ async function getGraphHopperRoute(
details: graphhopperDetails, details: graphhopperDetails,
custom_model: privateRoads custom_model: privateRoads
? {} ? {}
: { : graphhopperBlockPrivateCustomModels[graphHopperProfile] || {},
priority: [
{
if: 'road_access == PRIVATE',
multiply_by: '0.0',
},
],
},
}), }),
}); });