Skip to content

Commit

Permalink
feat: improve location data coming from Nominatim (#58)
Browse files Browse the repository at this point in the history
* Nominatim: fetch address details

* Return more results

* Exclude some nominatim location result types
  • Loading branch information
raphodn authored Dec 23, 2023
1 parent 1040f33 commit a13ea91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCookies } from '@vueuse/integrations/useCookies'

const NOMINATIM_RESULT_TYPE_EXCLUDE_LIST = ['fuel', 'gas', 'casino']
const USERNAME_COOKIE_KEY = 'username'
const TOKEN_COOKIE_KEY = 'access_token'
const RECENT_LOCATIONS_LOCAL_STORAGE_KEY = 'recent_locations'
Expand Down Expand Up @@ -126,10 +127,11 @@ export default {
},

openstreetmapNominatimSearch(q) {
return fetch(`https://nominatim.openstreetmap.org/search?q=${q}&format=json&limit=5`, {
return fetch(`https://nominatim.openstreetmap.org/search?q=${q}&addressdetails=1&format=json&limit=10`, {
method: 'GET',
})
.then((response) => response.json())
.then((data) => data.filter(l => !NOMINATIM_RESULT_TYPE_EXCLUDE_LIST.includes(l.type)))
},

getRecentLocations(limit=null) {
Expand Down

0 comments on commit a13ea91

Please sign in to comment.