From a2366a26bdf7c710e330c907e4fbc6929d77907c Mon Sep 17 00:00:00 2001 From: Gautier P Date: Thu, 3 Dec 2020 00:06:20 +0100 Subject: [PATCH] Split ring in two to avoid routing issue --- js/control/Message.js | 2 ++ js/plugin/CircleGoArea.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/js/control/Message.js b/js/control/Message.js index 426ebde..fe1a213 100644 --- a/js/control/Message.js +++ b/js/control/Message.js @@ -50,6 +50,8 @@ BR.Message = L.Class.extend({ err = i18next.t('warning.invalid-route-to'); } else if (err == 'from-position not mapped in existing datafile\n') { err = i18next.t('warning.invalid-route-from'); + } else if (err && err.startsWith('null description for: ')) { + err = i18next.t('warning.no-route-found'); } this._show(err, 'error'); }, diff --git a/js/plugin/CircleGoArea.js b/js/plugin/CircleGoArea.js index fe0c07f..eeab771 100644 --- a/js/plugin/CircleGoArea.js +++ b/js/plugin/CircleGoArea.js @@ -173,6 +173,9 @@ BR.CircleGoArea = L.Control.extend({ } inner.push(inner[0]); + /* hack: it seems there is a bug when using a single closed ring line, + cf. https://github.com/nrenner/brouter-web/issues/349#issue-755514458 + so instead we use 2 half rings to ensure we properly close the area */ return { type: 'FeatureCollection', features: [ @@ -181,7 +184,15 @@ BR.CircleGoArea = L.Control.extend({ properties: {}, geometry: { type: 'LineString', - coordinates: inner + coordinates: inner.slice(n / 2 - 1) + } + }, + { + type: 'Feature', + properties: {}, + geometry: { + type: 'LineString', + coordinates: inner.slice(0, n / 2 + 1) } } ]