From e18b00dad4615053b2f014d3e5333bddeff6d75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zbytovsk=C3=BD?= Date: Sun, 22 Sep 2024 09:09:40 +0200 Subject: [PATCH] Directions: add snap_prevention=ferry (#578) --- src/components/Directions/routing/getGraphhopperResults.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Directions/routing/getGraphhopperResults.ts b/src/components/Directions/routing/getGraphhopperResults.ts index 32dcdd8b..5364c30a 100644 --- a/src/components/Directions/routing/getGraphhopperResults.ts +++ b/src/components/Directions/routing/getGraphhopperResults.ts @@ -4,6 +4,8 @@ import { fetchJson } from '../../../services/fetch'; import { getBbox } from '../../../services/getCenter'; import { FetchError } from '../../../services/helpers'; +const API_KEY = `f189b841-6529-46c6-8a91-51f17477dcda`; + export const profiles: Record = { car: 'car', bike: 'bike', @@ -17,7 +19,7 @@ export const getGraphhopperResults = async ( const profile = profiles[mode]; const from = points[0].toReversed().join(','); // lon,lat! const to = points[1].toReversed().join(','); - const url = `https://graphhopper.com/api/1/route?point=${from}&point=${to}&vehicle=${profile}&key=f189b841-6529-46c6-8a91-51f17477dcda&type=json&points_encoded=false&instructions=false`; + const url = `https://graphhopper.com/api/1/route?point=${from}&point=${to}&vehicle=${profile}&key=${API_KEY}&type=json&points_encoded=false&instructions=false&snap_prevention=ferry`; const data = await fetchJson(url);