|
|
@ -29,8 +29,9 @@ export const createOsmClient = (): Geocoder => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
geocode: async (query) => { |
|
|
|
geocode: async (query) => |
|
|
|
const result = await queue.add(() => geocoder.geocode(query)); |
|
|
|
queue.add(async () => { |
|
|
|
|
|
|
|
const result = await geocoder.geocode(query); |
|
|
|
|
|
|
|
|
|
|
|
if (!result.length) { |
|
|
|
if (!result.length) { |
|
|
|
throw new Error('No results found'); |
|
|
|
throw new Error('No results found'); |
|
|
@ -58,6 +59,6 @@ export const createOsmClient = (): Geocoder => { |
|
|
|
latitude: meanLatitude, |
|
|
|
latitude: meanLatitude, |
|
|
|
longitude: meanLongitude, |
|
|
|
longitude: meanLongitude, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}), |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|