Skip to content

📍 Finds the country name, alpha-2 and alpha-3 codes from latitude and longitude

License

Notifications You must be signed in to change notification settings

Lissy93/find-region-from-location

Repository files navigation

find-region-from-location

Build Status Dependency Status devDependency Status Code Climate

Node module to find closest region for a given latitude and longitude

Install

npm install https://github.com/Lissy93/find-region-from-location --save

Usage

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 
}

Testing

npm test

See unit test, integration testing results on Travis CI

Development

See the gulpfile.js for documentation of build process.

License

MIT � Alicia Sykes

About

📍 Finds the country name, alpha-2 and alpha-3 codes from latitude and longitude

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published