Closed samhagman closed 7 years ago
No you should not, seems like a bug which version of the module, and node are you using?
With the latest version seems to work
const NodeGeocoder = require('node-geocoder');
const geocoder = NodeGeocoder({
provider: 'google'
})
geocoder.geocode('29 champs elysée paris', function(err, res) {
console.log(res, err);
});
// output
[ { formattedAddress: '29 Av. des Champs-Élysées, 75008 Paris, France',
latitude: 48.869384,
longitude: 2.3071868,
extra:
{ googlePlaceId: 'ChIJ4e9zicRv5kcRi_EQo6FKduM',
confidence: 1,
premise: null,
subpremise: null,
neighborhood: 'Paris',
establishment: null },
administrativeLevels:
{ level2long: 'Paris',
level2short: 'Paris',
level1long: 'Île-de-France',
level1short: 'Île-de-France' },
streetNumber: '29',
streetName: 'Avenue des Champs-Élysées',
city: 'Paris',
country: 'France',
countryCode: 'FR',
zipcode: '75008',
provider: 'google' } ] null
Hey! So I had checked our package.json version and it was the latest but our yarn lockfile had an older version. So updated to the latest version and everything is now working as it should! False alarm, thank you for the response.
In your example you say you can just pass in an unescaped string:
If I try to pass in a string with any spaces in it at all I get this error:
Any help would be much appreciated!