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

country-iso

Package Overview
Dependencies
Maintainers
1
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.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-6.49%
Maintainers
1
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.

Install

$ npm install --save country-iso
$ npm install --save world-countries-boundaries-100m

Countries bounds map file

In order to use this package you need to provide a valid GeoJSON FeatureCollection object with the ISO_A3 property set for each country. You can get one with customizable accuracy from world-countries-boundaries repo.

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

Usage

const countryCode = require('country-iso');

// Load a GeoJSON with country boundaries
countryCode.use(require('world-countries-boundaries-1m')());

// query a point
countryCode.get(42.50779, 1.52109);
// => 'AD'

API

use(geoJson)

Pre computes an R-Tree from a GeoJSON Object and uses the data future queries.

geoJson

Type: object

A valid GeoJSON FeatureCollection, each feature must have the ISO_A3 property.

get(lat, lng)

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

lat

Type: number

Latitude of the point.

lng

Type: number

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 05 Sep 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