feat: add more context in overpass importer autocomplete results

This commit is contained in:
Yohan Boniface 2024-09-02 17:01:04 +02:00
parent 33b0f6c318
commit f3f61f5d98

View file

@ -25,10 +25,20 @@ class Autocomplete extends SingleMixin(BaseAjax) {
} }
createResult(item) { createResult(item) {
const labels = [item.properties.name]
if (item.properties.county) {
labels.push(item.properties.county)
}
if (item.properties.state) {
labels.push(item.properties.state)
}
if (item.properties.country) {
labels.push(item.properties.country)
}
return super.createResult({ return super.createResult({
// Overpass convention to get their id from an osm one. // Overpass convention to get their id from an osm one.
value: item.properties.osm_id + 3600000000, value: item.properties.osm_id + 3600000000,
label: `${item.properties.name}`, label: labels.join(', '),
}) })
} }
} }