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:
@@ -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
|
||||
Reference in New Issue
Block a user