Merge pull request #2087 from umap-project/overpass-autocomplete-context

feat: add more context in overpass importer autocomplete results
This commit is contained in:
Yohan Boniface 2024-09-03 15:31:37 +02:00 committed by GitHub
commit 6a8be34dcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,10 +25,20 @@ class Autocomplete extends SingleMixin(BaseAjax) {
}
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({
// Overpass convention to get their id from an osm one.
value: item.properties.osm_id + 3600000000,
label: `${item.properties.name}`,
label: labels.join(', '),
})
}
}