Simple node wrapper for geocoding endpoints of the PostCoder Web API from Allies.
Find out more about the geocoding API and sign up for a trial to get an API key
Note: This is a paid for API
The API allows searching for forward and reverse UK geocoding.
For full developer documentation
npm install postcoder-geocoding
https://www.npmjs.com/package/postcoder-geocoding
var geocoding = require("postcoder-geocoding");
geocoding.init("[YOUR API KEY HERE]");
geocoding.geoFromPostcode("NR14 7PZ", function(result, error) {
if (error) {
console.log(error);
} else {
// returns an array of locations containing latitude and longitude
console.log(result);
}
});
Also returns OS Eastings and Northings.
var geocoding = require("postcoder-geocoding");
geocoding.init("[YOUR API KEY HERE]");
geocoding.searchStreetGeo("NR14 7PZ", function(result, error) {
if (error) {
console.log(error);
} else {
// returns an array of locations containing street level data, latitude and longitude
console.log(result);
}
});
Returns street name, county name and more alongside the same fields as the geoFromPostcode method, full list of fields
var geocoding = require("postcoder-geocoding");
geocoding.init("[YOUR API KEY HERE]");
// Passing in latitude, longitude and radius (metres)
geocoding.streetFromGeo("52.5859714116", "1.3492192897", "50", function(result, error) {
if (error) {
console.log(error);
} else {
// returns an array of locations containing street level data, latitude and longitude
console.log(result);
}
});
Returns an object with information about number of credits on your account and more
var address_lookup = require("postcoder-geocoding");
address_lookup.init("[YOUR API KEY HERE]");
address_lookup.checkStatus(function(result, error) {
if (error) {
console.log(error);
} else {
// returns an object with information about number of credits on your account and more
console.log(result);
}
});
This is a community supported package, maintained by Stephen Keable