reinit whereinputadvanced in /add , and init only/also online mechanism, various fixes: admin edit place; bug in nominatim display_name when place in certain nominatim_class, init refactor geocoding related code in services/geocoding/provider; init MapEdit component

This commit is contained in:
sedum
2023-02-17 00:23:35 +01:00
parent 6aceaba7f7
commit 79ebec9116
21 changed files with 1558 additions and 255 deletions

View File

@@ -1,5 +1,6 @@
const cache = require('memory-cache')
const providerCache = new cache.Cache()
const get = require('lodash/get')
const nominatim = {
commonName: 'Nominatim',
@@ -23,6 +24,39 @@ const nominatim = {
}
},
/*
* Icons to nominatim `osm_type` and `class` conversion
*/
searchIcons_nominatim_osm_type: {
way: 'mdiRoadVariant',
house: 'mdiHome',
node: 'mdiMapMarker',
relation: 'mdiCityVariant',
},
searchIcons_nominatim_class: {
mdiHome: ['place', 'amenity', 'shop', 'tourism', 'leisure', 'building']
},
filterNameFromAddress: ['place', 'amenity', 'shop', 'tourism', 'leisure', 'building'],
mapQueryResults (ret, addressList = []) {
if (ret && ret.length) {
addressList = ret.map(v => {
const name = get(v.namedetails, 'alt_name', get(v.namedetails, 'name'))
const address = this.filterNameFromAddress.includes(v.class) ? v.display_name.replace(name, '').replace(/^, ?/, '') : v.display_name.replace(/^, ?/, '')
return {
class: v.class,
type: v.osm_type,
lat: v.lat,
lon: v.lon,
name,
address
}
})
}
return addressList
}
}
module.exports = nominatim