farruxx / which-state

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

which-state

Get US state name by coordinates

Forked from which-country

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-state

and then:

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

// pass [lng, lat]
console.log(wc([-107, 40])); // Colorado
console.log(wc([40, -40])); // null, somewhere in Atlantic Ocean

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


Languages

Language:JavaScript 93.0%Language:HTML 6.0%Language:CSS 1.0%