Node module to find closest region for a given latitude and longitude
npm install https://github.com/Lissy93/find-region-from-location --save
var findRegion = require('find-region-from-location');
findRegion.country(52.2, -1.6); // 'United Kingdom'
findRegion.alpha2_code(-8.29, -50); // 'BR'
findRegion.alpha3_code(40, -3); // 'ESP'
findRegion.numeric_code(48.8,2.5); // '250'
There are 5 functions, country(lat, lng)
, alpha2_code(lat, lng)
, alpha3_code(lat, lng)
, numeric_code(lat, lng)
and regionObject(lat, lng)
regionObject(latitude, longitude)
will return data in the following format:
{
country: 'France',
alpha2_code: 'FR',
alpha3_code: 'FRA',
numeric_code: '250',
latitude: 46,
longitude: 2,
diff: 3
}
npm test
See unit test, integration testing results on Travis CI
See the gulpfile.js
for documentation of build process.
MIT � Alicia Sykes