A promises based node.js wrapper for the Geonames.org API.
Installing using npm:
npm i geocoder-geonames
var GeocoderGeonames = require('geocoder-geonames'),
geocoder = new GeocoderGeonames({
username: 'Your Geonames.org username',
});
The constructor function also takes an optional configuration object:
- premium: true || false
- endpoint: specify
geocoder.get('search',{
q: 'Berlin'
})
.then(function(response){
console.log(response);
})
.catch(function(error){
console.log(error);
});
Optional parameters:
- you can pass all request parameters
All methods return a promise.