add filter by countrycodes, and allow to change geolocation providers

This commit is contained in:
sedum
2022-12-02 11:25:43 +01:00
parent 4d9030e8fb
commit c096a616ba
10 changed files with 1210 additions and 16 deletions

View File

@@ -76,19 +76,28 @@ module.exports = {
async _nominatim (req, res) {
const details = req.params.place_details
const countrycodes = res.locals.settings.geocoding_countrycodes
const geocoding_provider = res.locals.settings.geocoding_provider
// ?limit=3&format=json&namedetails=1&addressdetails=1&q=
console.log(countrycodes)
console.log(geocoding_provider)
const ret = await axios.get(`${NOMINATIM_URL}`, {
const ret = await axios.get(`${res.locals.settings.geocoding_provider}`, {
params: {
countrycodes: countrycodes || '',
q: details,
limit: 3,
format: 'json',
addressdetails: 1,
namedetails: 1
namedetails: 1,
},
headers: { 'User-Agent': 'gancio 1.6.0' }
})
console.log(countrycodes)
console.log(ret)
return res.json(ret.data)
},
}

View File

@@ -30,8 +30,10 @@ const defaultSettings = {
allow_recurrent_event: false,
recurrent_event_visible: false,
allow_geolocation: true,
// geocoding_provider: '',
// tilelayer_provider: '',
geocoding_provider: 'https://nominatim.openstreetmap.org/',
geocoding_countrycodes: [],
tilelayer_provider: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
tilelayer_provider_attribution: "<a target=\"_blank\" href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors",
enable_federation: true,
enable_resources: false,
hide_boosts: true,