Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

country-iso

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-iso

Get ISO 3166-1 alpha-3 country code for geographic coordinates.

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
increased by4.69%
Maintainers
2
Weekly downloads
 
Created
Source

country-iso

Travis CI Codecov npm npm version npm dependencies npm dev dependencies

🗺 Get ISO 3166-1 alpha-3 country code for geographic coordinates.

Click on the map for a live preview.

Install

$ 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.

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 package internally uses @geo-maps/countries-maritime map with 10m resolution.

The accuracy of the map has been tested with 23785 cities.

API

get(lat, lng) ⇒ Array.<string>

Searches for every country which contains the point (lat, lng).

Returns: Array.<string> - Array of ISO 3166 alpha-3 country code for the geographic coordinates.

ParamTypeDescription
latnumberThe latitude of the point.
lngnumberThe longitude of the point.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 04 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc