Get ISO 3166-1 alpha-3 country code for geographic coordinates.
npm install country-iso> Click on the map for a live preview.
bash
$ npm install --save country-iso
`Usage
You can query any (lat,lng) pair on the earth. It also works for territorial waters and disputed countries.`javascript
const countryIso = require('country-iso');// Query a point in Italy.
countryIso.get(41.9028, 12.4964);
// => ['ITA']
// Query a disputed country.
countryIso.get(24, -14);
// => ['ESH', 'MAR']
// Query a point somewhere in Atlantic Ocean.
countryIso.get(40, -40);
// => []
``> The accuracy of the map has been tested with 23785 cities.
Array.<string>Returns: Array.<string> - Array of ISO 3166 alpha-3 country code for the geographic
coordinates.
| Param | Type | Description |
| --- | --- | --- |
| lat | number | The latitude of the point. |
| lng | number | The longitude of the point. |
See also the list of contributors who participated in this project.