From 1c70c59df38b945a7a0ce42efc9f952b1d1251f7 Mon Sep 17 00:00:00 2001 From: Remi <73385395+itsrubberduck@users.noreply.github.com> Date: Sat, 18 Oct 2025 21:08:24 +0200 Subject: [PATCH 1/3] Preserve raw taxi route names --- server/api/service/tools/taxiroute.get.ts | 48 ++++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/server/api/service/tools/taxiroute.get.ts b/server/api/service/tools/taxiroute.get.ts index 7b7d66c..dbe88f7 100644 --- a/server/api/service/tools/taxiroute.get.ts +++ b/server/api/service/tools/taxiroute.get.ts @@ -153,17 +153,54 @@ out body; start_attach: startAttach, end_attach: endAttach, route: null, - names: [] + names: [], + names_collapsed: [] } } - // names along path (consecutive compressed, drop null/unnamed) - const namesSeq: string[] = [] + // names along path (drop null/unnamed); keep both raw sequence and collapsed variant + const normalizeName = (value: string) => { + const trimmed = value.trim() + if (!trimmed) return null + const match = trimmed.match(/^([A-Za-z]+)/) + return (match ? match[1] : trimmed).toUpperCase() + } + const isPlainLetter = (value: string) => /^[A-Za-z]+$/.test(value.trim()) + + const namesRaw: string[] = [] + const namesCollapsed: string[] = [] + const hasDigits = (value: string) => /\d/.test(value) for (let i=0;i${v}`) || edgeName.get(`${v}->${u}`) const nm = meta?.name?.trim() - if (nm && (namesSeq.length===0 || namesSeq[namesSeq.length-1]!==nm)) namesSeq.push(nm) + if (!nm) continue + + if (namesRaw.length === 0 || namesRaw[namesRaw.length-1] !== nm) namesRaw.push(nm) + + const normalized = normalizeName(nm) + if (!normalized) continue + + const last = namesCollapsed[namesCollapsed.length-1] + if (!last){ + namesCollapsed.push(nm) + continue + } + + const lastNormalized = normalizeName(last) + if (lastNormalized === normalized){ + const lastHasDigits = hasDigits(last) + const currentHasDigits = hasDigits(nm) + + if (currentHasDigits && lastHasDigits) { + continue + } + + if (isPlainLetter(nm) && !isPlainLetter(last)) namesCollapsed[namesCollapsed.length-1] = nm + continue + } + + namesCollapsed.push(nm) } return { @@ -175,6 +212,7 @@ out body; node_ids: sp.path, total_distance_m: sp.total_m }, - names: namesSeq + names: namesRaw, + names_collapsed: namesCollapsed } }) From c5e6eb1f92b700845f1d47234a493cbc16d4a936 Mon Sep 17 00:00:00 2001 From: Remi <73385395+itsrubberduck@users.noreply.github.com> Date: Sat, 18 Oct 2025 21:33:43 +0200 Subject: [PATCH 2/3] Adjust taxi route collapse rules --- server/api/service/tools/taxiroute.get.ts | 32 +++++------------------ 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/server/api/service/tools/taxiroute.get.ts b/server/api/service/tools/taxiroute.get.ts index dbe88f7..c95bff8 100644 --- a/server/api/service/tools/taxiroute.get.ts +++ b/server/api/service/tools/taxiroute.get.ts @@ -159,14 +159,6 @@ out body; } // names along path (drop null/unnamed); keep both raw sequence and collapsed variant - const normalizeName = (value: string) => { - const trimmed = value.trim() - if (!trimmed) return null - const match = trimmed.match(/^([A-Za-z]+)/) - return (match ? match[1] : trimmed).toUpperCase() - } - const isPlainLetter = (value: string) => /^[A-Za-z]+$/.test(value.trim()) - const namesRaw: string[] = [] const namesCollapsed: string[] = [] const hasDigits = (value: string) => /\d/.test(value) @@ -178,26 +170,16 @@ out body; if (namesRaw.length === 0 || namesRaw[namesRaw.length-1] !== nm) namesRaw.push(nm) - const normalized = normalizeName(nm) - if (!normalized) continue - const last = namesCollapsed[namesCollapsed.length-1] - if (!last){ - namesCollapsed.push(nm) - continue - } + if (last) { + const lastNormalized = last.replace(/\s+/g, '').match(/^([A-Za-z]+)/)?.[1]?.toUpperCase() + const currentNormalized = nm.replace(/\s+/g, '').match(/^([A-Za-z]+)/)?.[1]?.toUpperCase() - const lastNormalized = normalizeName(last) - if (lastNormalized === normalized){ - const lastHasDigits = hasDigits(last) - const currentHasDigits = hasDigits(nm) - - if (currentHasDigits && lastHasDigits) { - continue + if (lastNormalized && currentNormalized && lastNormalized === currentNormalized) { + if (hasDigits(last) && hasDigits(nm)) { + continue + } } - - if (isPlainLetter(nm) && !isPlainLetter(last)) namesCollapsed[namesCollapsed.length-1] = nm - continue } namesCollapsed.push(nm) From 21f058b25a143acf2f11281bf393b8f8ab711360 Mon Sep 17 00:00:00 2001 From: Remi <73385395+itsrubberduck@users.noreply.github.com> Date: Sat, 18 Oct 2025 21:46:55 +0200 Subject: [PATCH 3/3] Refine taxiway collapse and radius default --- server/api/service/tools/taxiroute.get.ts | 29 ++++++++++++++--------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/server/api/service/tools/taxiroute.get.ts b/server/api/service/tools/taxiroute.get.ts index c95bff8..4bf4e05 100644 --- a/server/api/service/tools/taxiroute.get.ts +++ b/server/api/service/tools/taxiroute.get.ts @@ -5,7 +5,7 @@ export default defineEventHandler(async (event) => { const q = getQuery(event) const oLat = Number(q.origin_lat), oLon = Number(q.origin_lng) const dLat = Number(q.dest_lat), dLon = Number(q.dest_lng) - const radius = Number(q.radius ?? 2000) + const radius = Number(q.radius ?? 5000) const endpoint = 'https://overpass-api.de/api/interpreter' const overpassQ = ` @@ -160,7 +160,6 @@ out body; // names along path (drop null/unnamed); keep both raw sequence and collapsed variant const namesRaw: string[] = [] - const namesCollapsed: string[] = [] const hasDigits = (value: string) => /\d/.test(value) for (let i=0;i