Closed scraly closed 3 months ago
Upon deeper inspection, not providing 'User-Agent' header violates OSM Policy:
This works:
const fetch = require('fix-esm').require('node-fetch').default;
const NodeGeocoder = require('node-geocoder');
let options = {
provider: 'openstreetmap',
fetch(url, options) {
return fetch(url, {...options, headers: { 'user-agent': 'dca-0' }})
}
};
const geocoder = NodeGeocoder(options);
const locations = ['Tacoma, WA (USA)'];
geocoder.batchGeocode(locations).then(result => {
console.dir(result, {depth:null});
});
Thanks! Fixed in commit: https://github.com/scraly/developers-conferences-agenda/commit/eb3f09301ddca2abeede5818b07db7866b73763b
dca-0 is a good idea for a unique user-agent thanks :)
I've got two troubles to identify geocoding even if it's working on openstreetmap website