Split ring in two to avoid routing issue

This commit is contained in:
Gautier P 2020-12-03 00:06:20 +01:00
parent 8ca602575c
commit a2366a26bd
2 changed files with 14 additions and 1 deletions

View file

@ -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');
},

View file

@ -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)
}
}
]