Skip to content

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

Notifications You must be signed in to change notification settings

josebernalte/which-country

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

which-country

Get ISO 3166-1 alpha-3 country code for geographic coordinates in node.js or browser.

CAVEAT: currently doesn't work for points in territorial waters

Powered by rbush and modified Natural Earth 50m countries dataset.

If you are interested in more general solution, try which-polygon.

Usage

npm install which-country

and then:

var wc = require('which-country');

// pass [lng, lat]
console.log(wc([37, 55])); // RUS
console.log(wc([-100, 40])); // USA
console.log(wc([40, -40])); // null, somewhere in Atlantic Ocean

#Demo

Demo whith leaflet and browserify

Development

Run tests:

npm test

Generate R-tree:

npm run generate

License

MIT

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.0%
  • HTML 6.0%
  • CSS 1.0%