From 317b9521b191dbc0cc95555075db3370c29d587f Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Wed, 3 May 2023 16:34:31 +0200 Subject: [PATCH 01/19] Update valhalla.js Graphhopper to V7 In API version 7 of graphhopper the support for vehicle parameter has been dropped. You have to use the profile parameter. see: https://github.com/graphhopper/graphhopper/blob/master/CHAN GELOG.md --- lib/scenario-editor/utils/valhalla.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 408a8cec5..78e555862 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,7 +257,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo const params = { key: graphHopperKey, - vehicle: 'car', + profile: 'car', debug: true, type: 'json' } @@ -277,7 +277,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo }, debug: params.debug, points: points.map(p => [p.lng, p.lat]), - profile: params.vehicle + profile: params.profile }), headers: { 'Content-Type': 'application/json' From 2f2b50aafeccfd6c0588d67ac60d52c2c8744747 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 09:00:18 +0200 Subject: [PATCH 02/19] Update env.yml.tmp --- configurations/default/env.yml.tmp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configurations/default/env.yml.tmp b/configurations/default/env.yml.tmp index cd33e6772..63dcda78c 100644 --- a/configurations/default/env.yml.tmp +++ b/configurations/default/env.yml.tmp @@ -11,6 +11,8 @@ SLACK_WEBHOOK: optional-slack-webhook GRAPH_HOPPER_KEY: your-graph-hopper-key # Optional override to use a custom service instead of the graphhopper.com hosted service. # GRAPH_HOPPER_URL: http://localhost:8989/ +# If your'e hosting a version 7 graphhopper instance set this to yes, default is No +# GRAPH_HOPPER_V7: Yes # Optional overrides to use custom service or different api key for certain bounding boxes. # (uncomment below to enable) # GRAPH_HOPPER_ALTERNATES: From 7c149ad3349cd0e1635f0ac9b1171b29c5289ad7 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 09:42:13 +0200 Subject: [PATCH 03/19] set true instead of yes/no --- configurations/default/env.yml.tmp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configurations/default/env.yml.tmp b/configurations/default/env.yml.tmp index 63dcda78c..8671f80de 100644 --- a/configurations/default/env.yml.tmp +++ b/configurations/default/env.yml.tmp @@ -11,8 +11,8 @@ SLACK_WEBHOOK: optional-slack-webhook GRAPH_HOPPER_KEY: your-graph-hopper-key # Optional override to use a custom service instead of the graphhopper.com hosted service. # GRAPH_HOPPER_URL: http://localhost:8989/ -# If your'e hosting a version 7 graphhopper instance set this to yes, default is No -# GRAPH_HOPPER_V7: Yes +# If your'e hosting a version 7 graphhopper instance set this to yes, default is false or not configured +# GRAPH_HOPPER_V7: true # Optional overrides to use custom service or different api key for certain bounding boxes. # (uncomment below to enable) # GRAPH_HOPPER_ALTERNATES: From 5fc821c749dd730fbb6dded4e14adc34b08e19a3 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 10:18:47 +0200 Subject: [PATCH 04/19] Update valhalla.js to use paramater for V7 --- lib/scenario-editor/utils/valhalla.js | 34 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 78e555862..065bf9485 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -204,7 +204,8 @@ export async function getSegment ( /** * Call GraphHopper routing service with lat/lng coordinates. * - * Example URL: https://graphhopper.com/api/1/route?point=49.932707,11.588051&point=50.3404,11.64705&vehicle=car&debug=true&&type=json + * Example URL V5/6: https://graphhopper.com/api/1/route?point=49.932707,11.588051&point=50.3404,11.64705&vehicle=car&debug=true&type=json + * Example URL V7: https://graphhopper.com/api/1/route?point=49.932707,11.588051&point=50.3404,11.64705&profile=car&debug=true&type=json */ export function routeWithGraphHopper (points: Array, avoidMotorways?: boolean): ?Promise { if (points.length < 2) { @@ -256,17 +257,14 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } const params = { - key: graphHopperKey, - profile: 'car', + key: graphHopperKey, debug: true, type: 'json' - } + } + const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') // Avoiding motorways requires a POST request with a formatted body - const graphHopperRequest = avoidMotorways - ? fetch(`${graphHopperUrl}route?key=${params.key}`, - { - body: JSON.stringify({ + const avoidmotorwaysbody = { 'ch.disable': true, // Custom model disincentives motorways custom_model: { @@ -276,9 +274,23 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo }] }, debug: params.debug, - points: points.map(p => [p.lng, p.lat]), - profile: params.profile - }), + points: points.map(p => [p.lng, p.lat]) + } + + // Version 7 of the graphhopper api will not allow the inclusion of the old vehicle parameter, it needs the profile paramater set. + if (process.env.GRAPH_HOPPER_V7) { + params['profile'] = 'car' + avoidmotorwaysbody['profile'] = 'car' + } + else { + params['vehicle'] = 'car' + avoidmotorwaysbody['vehicle'] = 'car' + } + + const graphHopperRequest = avoidMotorways + ? fetch(`${graphHopperUrl}route?key=${params.key}`, + { + body: JSON.stringify(avoidmotorwaysbody), headers: { 'Content-Type': 'application/json' }, From 5df01cd07c4689a92092b1a2025fc33ea7c4ed22 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 10:38:29 +0200 Subject: [PATCH 05/19] Fix linting --- lib/scenario-editor/utils/valhalla.js | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 065bf9485..dd6062bbf 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,25 +257,25 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } const params = { - key: graphHopperKey, + key: graphHopperKey, debug: true, type: 'json' - } + } const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') // Avoiding motorways requires a POST request with a formatted body const avoidmotorwaysbody = { - 'ch.disable': true, - // Custom model disincentives motorways - custom_model: { - 'priority': [{ - 'if': 'road_class == MOTORWAY', - 'multiply_by': 0.1 - }] - }, - debug: params.debug, - points: points.map(p => [p.lng, p.lat]) - } + 'ch.disable': true, + // Custom model disincentives motorways + custom_model: { + 'priority': [{ + 'if': 'road_class == MOTORWAY', + 'multiply_by': 0.1 + }] + }, + debug: params.debug, + points: points.map(p => [p.lng, p.lat]) + } // Version 7 of the graphhopper api will not allow the inclusion of the old vehicle parameter, it needs the profile paramater set. if (process.env.GRAPH_HOPPER_V7) { @@ -286,7 +286,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo params['vehicle'] = 'car' avoidmotorwaysbody['vehicle'] = 'car' } - + const graphHopperRequest = avoidMotorways ? fetch(`${graphHopperUrl}route?key=${params.key}`, { From 797db24d72296738ce605220aecbe05db75a34cb Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 10:44:34 +0200 Subject: [PATCH 06/19] Update valhalla.js fix linting v2 --- lib/scenario-editor/utils/valhalla.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index dd6062bbf..0aa1cc886 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -269,14 +269,14 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo // Custom model disincentives motorways custom_model: { 'priority': [{ - 'if': 'road_class == MOTORWAY', - 'multiply_by': 0.1 - }] - }, - debug: params.debug, - points: points.map(p => [p.lng, p.lat]) + 'if': 'road_class == MOTORWAY', + 'multiply_by': 0.1 + }] + }, + debug: params.debug, + points: points.map(p => [p.lng, p.lat]) } - + // Version 7 of the graphhopper api will not allow the inclusion of the old vehicle parameter, it needs the profile paramater set. if (process.env.GRAPH_HOPPER_V7) { params['profile'] = 'car' From 4645f7cc2da847af7014f8b7c4c598f9c5f8fa37 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 10:52:12 +0200 Subject: [PATCH 07/19] Update valhalla.js fix linting V3 --- lib/scenario-editor/utils/valhalla.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 0aa1cc886..1505f9e55 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -281,8 +281,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo if (process.env.GRAPH_HOPPER_V7) { params['profile'] = 'car' avoidmotorwaysbody['profile'] = 'car' - } - else { + } else { params['vehicle'] = 'car' avoidmotorwaysbody['vehicle'] = 'car' } From 2cfe6993618321aa851b2811af61f357597e6033 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 11:11:05 +0200 Subject: [PATCH 08/19] Update valhalla.js fix linting v5 --- lib/scenario-editor/utils/valhalla.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 1505f9e55..d13b77019 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -261,7 +261,6 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo debug: true, type: 'json' } - const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') // Avoiding motorways requires a POST request with a formatted body const avoidmotorwaysbody = { From 95835bfc6bc307076b43418c053427614e8930fd Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 12:00:16 +0200 Subject: [PATCH 09/19] Use other defintion of the profile property --- lib/scenario-editor/utils/valhalla.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index d13b77019..4eac91b08 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -256,10 +256,14 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo }) } + // Version 7 of the graphhopper api uses profile instead of vehicle. + const params = { key: graphHopperKey, debug: true, type: 'json' + ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), + ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) } const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') // Avoiding motorways requires a POST request with a formatted body @@ -273,18 +277,11 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo }] }, debug: params.debug, - points: points.map(p => [p.lng, p.lat]) + points: points.map(p => [p.lng, p.lat]), + ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), + ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) } - - // Version 7 of the graphhopper api will not allow the inclusion of the old vehicle parameter, it needs the profile paramater set. - if (process.env.GRAPH_HOPPER_V7) { - params['profile'] = 'car' - avoidmotorwaysbody['profile'] = 'car' - } else { - params['vehicle'] = 'car' - avoidmotorwaysbody['vehicle'] = 'car' - } - + const graphHopperRequest = avoidMotorways ? fetch(`${graphHopperUrl}route?key=${params.key}`, { From 40fdf61e975273d63f76e1c41e3188a43fb805cd Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 12:04:29 +0200 Subject: [PATCH 10/19] Update valhalla.js fix alternative method --- lib/scenario-editor/utils/valhalla.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 4eac91b08..318282b48 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -261,7 +261,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo const params = { key: graphHopperKey, debug: true, - type: 'json' + type: 'json', ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) } From f349f663c23f4d4bccdf39fa263d9a403b287575 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 12:07:58 +0200 Subject: [PATCH 11/19] Update valhalla.js fix linting --- lib/scenario-editor/utils/valhalla.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 318282b48..de8ebad9c 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -280,8 +280,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo points: points.map(p => [p.lng, p.lat]), ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) - } - + } const graphHopperRequest = avoidMotorways ? fetch(`${graphHopperUrl}route?key=${params.key}`, { From 6d2231cd5b6e348f34547949fa8c61910ac88afe Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 12:11:08 +0200 Subject: [PATCH 12/19] Update valhalla.js fix linting v2 --- lib/scenario-editor/utils/valhalla.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index de8ebad9c..644c15e86 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -280,7 +280,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo points: points.map(p => [p.lng, p.lat]), ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) - } + } const graphHopperRequest = avoidMotorways ? fetch(`${graphHopperUrl}route?key=${params.key}`, { From 2f9b05330df3e9e75c153e71f84f84227a88d96f Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 12:23:10 +0200 Subject: [PATCH 13/19] Update valhalla.js make default false --- lib/scenario-editor/utils/valhalla.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 644c15e86..2ba1c3a97 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -219,6 +219,7 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo // Use custom url if it exists, otherwise default to the hosted service. let graphHopperUrl = process.env.GRAPH_HOPPER_URL || 'https://graphhopper.com/api/1/' let graphHopperKey = process.env.GRAPH_HOPPER_KEY + let grapghhoperV7 = process.env.GRAPH_HOPPER_V7 || false if (process.env.GRAPH_HOPPER_ALTERNATES) { // $FlowFixMe This is a bit of a hack and now how env variables are supposed to work, but the yaml loader supports it. @@ -262,8 +263,8 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo key: graphHopperKey, debug: true, type: 'json', - ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), - ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) + ...(grapghhoperV7 && { profile: 'car' }), + ...(!grapghhoperV7 && { vehicle: 'car' }) } const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') // Avoiding motorways requires a POST request with a formatted body @@ -278,8 +279,8 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo }, debug: params.debug, points: points.map(p => [p.lng, p.lat]), - ...(process.env.GRAPH_HOPPER_V7 && { profile: 'car' }), - ...(!process.env.GRAPH_HOPPER_V7 && { vehicle: 'car' }) + ...(grapghhoperV7 && { profile: 'car' }), + ...(!grapghhoperV7 && { vehicle: 'car' }) } const graphHopperRequest = avoidMotorways ? fetch(`${graphHopperUrl}route?key=${params.key}`, From 8d3e66ba9ba6ba9079b56af6cec1b2eab8c416a8 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 13:31:04 +0200 Subject: [PATCH 14/19] Update valhalla.js different check based on 2 values --- lib/scenario-editor/utils/valhalla.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 2ba1c3a97..2cb9dc7ec 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -219,7 +219,6 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo // Use custom url if it exists, otherwise default to the hosted service. let graphHopperUrl = process.env.GRAPH_HOPPER_URL || 'https://graphhopper.com/api/1/' let graphHopperKey = process.env.GRAPH_HOPPER_KEY - let grapghhoperV7 = process.env.GRAPH_HOPPER_V7 || false if (process.env.GRAPH_HOPPER_ALTERNATES) { // $FlowFixMe This is a bit of a hack and now how env variables are supposed to work, but the yaml loader supports it. @@ -258,13 +257,19 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } // Version 7 of the graphhopper api uses profile instead of vehicle. - + let profilecar = false + let profileveh = true + // Only check for definition not the value. + if (process.env.GRAPH_HOPPER_V7) { + profilecar = true + profileveh = false + } const params = { key: graphHopperKey, debug: true, type: 'json', - ...(grapghhoperV7 && { profile: 'car' }), - ...(!grapghhoperV7 && { vehicle: 'car' }) + ...(profilecar && { profile: 'car' }), + ...(profileveh && { vehicle: 'car' }) } const locations = points.map(p => (`point=${p.lat},${p.lng}`)).join('&') // Avoiding motorways requires a POST request with a formatted body @@ -279,8 +284,8 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo }, debug: params.debug, points: points.map(p => [p.lng, p.lat]), - ...(grapghhoperV7 && { profile: 'car' }), - ...(!grapghhoperV7 && { vehicle: 'car' }) + ...(profilecar && { profile: 'car' }), + ...(profileveh && { vehicle: 'car' }) } const graphHopperRequest = avoidMotorways ? fetch(`${graphHopperUrl}route?key=${params.key}`, From dc6d49fd18aea6175b82cbbd4afe940846dd81f5 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 13:41:12 +0200 Subject: [PATCH 15/19] Update valhalla.js explicit boolean --- lib/scenario-editor/utils/valhalla.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 2cb9dc7ec..140b82abe 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,12 +257,12 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } // Version 7 of the graphhopper api uses profile instead of vehicle. - let profilecar = false - let profileveh = true + let profilecar = boolean(false) + let profileveh = boolean(true) // Only check for definition not the value. if (process.env.GRAPH_HOPPER_V7) { - profilecar = true - profileveh = false + profilecar = boolean(true) + profileveh = boolean(false) } const params = { key: graphHopperKey, From 60e1db7c28514aa0c7cbde946dec7bdf0d86b215 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 13:45:39 +0200 Subject: [PATCH 16/19] Update valhalla.js fix type name --- lib/scenario-editor/utils/valhalla.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 140b82abe..50a7a8e86 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,12 +257,12 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } // Version 7 of the graphhopper api uses profile instead of vehicle. - let profilecar = boolean(false) - let profileveh = boolean(true) + let profilecar = Boolean(false) + let profileveh = Boolean(true) // Only check for definition not the value. if (process.env.GRAPH_HOPPER_V7) { - profilecar = boolean(true) - profileveh = boolean(false) + profilecar = Boolean(true) + profileveh = Boolean(false) } const params = { key: graphHopperKey, From c0c00eba46033880ef4a5fecee8a5f749fbab918 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 13:48:31 +0200 Subject: [PATCH 17/19] Update valhalla.js fix boolean --- lib/scenario-editor/utils/valhalla.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 50a7a8e86..22b1f4244 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,12 +257,12 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } // Version 7 of the graphhopper api uses profile instead of vehicle. - let profilecar = Boolean(false) - let profileveh = Boolean(true) + let profilecar = false; + let profileveh = true; // Only check for definition not the value. if (process.env.GRAPH_HOPPER_V7) { - profilecar = Boolean(true) - profileveh = Boolean(false) + profilecar = true; + profileveh = false; } const params = { key: graphHopperKey, From 8400445aec3d976fdbdcf2d035b4bfe706ca0446 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 13:57:45 +0200 Subject: [PATCH 18/19] Update valhalla.js boolean --- lib/scenario-editor/utils/valhalla.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 22b1f4244..9edd4f18c 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,12 +257,12 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } // Version 7 of the graphhopper api uses profile instead of vehicle. - let profilecar = false; - let profileveh = true; + let profilecar = 0 + let profileveh = 1 // Only check for definition not the value. if (process.env.GRAPH_HOPPER_V7) { - profilecar = true; - profileveh = false; + profilecar = 1 + profileveh = 0 } const params = { key: graphHopperKey, From 1ad0d994223cf30fb1bef4d7b6e469153aac7c22 Mon Sep 17 00:00:00 2001 From: Martijn van Laar Date: Tue, 16 May 2023 14:33:19 +0200 Subject: [PATCH 19/19] Update valhalla.js fix for review --- lib/scenario-editor/utils/valhalla.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scenario-editor/utils/valhalla.js b/lib/scenario-editor/utils/valhalla.js index 9edd4f18c..2cb9dc7ec 100644 --- a/lib/scenario-editor/utils/valhalla.js +++ b/lib/scenario-editor/utils/valhalla.js @@ -257,12 +257,12 @@ export function routeWithGraphHopper (points: Array, avoidMotorways?: bo } // Version 7 of the graphhopper api uses profile instead of vehicle. - let profilecar = 0 - let profileveh = 1 + let profilecar = false + let profileveh = true // Only check for definition not the value. if (process.env.GRAPH_HOPPER_V7) { - profilecar = 1 - profileveh = 0 + profilecar = true + profileveh = false } const params = { key: graphHopperKey,