Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supersoniko/iso-by-coords
NPM package to get a Country's ISO code by coordinates
https://github.com/supersoniko/iso-by-coords
Last synced: about 5 hours ago
JSON representation
NPM package to get a Country's ISO code by coordinates
- Host: GitHub
- URL: https://github.com/supersoniko/iso-by-coords
- Owner: supersoniko
- License: mit
- Created: 2020-01-17T14:13:18.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-06T17:37:15.000Z (about 4 years ago)
- Last Synced: 2024-11-10T04:02:06.113Z (6 days ago)
- Language: TypeScript
- Size: 1.53 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iso-by-coords
![npm](https://img.shields.io/npm/v/iso-by-coords)
![NPM](https://img.shields.io/npm/l/iso-by-coords)
![David](https://img.shields.io/david/supersoniko/iso-by-coords.svg)## Usage
### TypeScript
```javascript
import configureCountryIso from 'iso-by-coords';
import {CountryISO} from 'iso-by-coords/lib/typings';
import getMap from 'countries-maritime-10m-extended';const {getIsoCodes: getIsoCodesAlpha2} = configureCountryIso({
iso: CountryISO.ALPHA_2,
map: getMap()
});const {getIsoCodes: getIsoCodesAlpha3} = configureCountryIso({
iso: CountryISO.ALPHA_3,
map: getMap()
});getIsoCodesAlpha2(50.95148037338329, 5.350969164113395); // returns [BE]
getIsoCodesAlpha3(50.95148037338329, 5.350969164113395); // returns [BEL]
```### JavaScript
```javascript
const configureCountryIso = require('iso-by-coords').default;
const getMap = require('countries-maritime-10m-extended');const {getIsoCodes: getIsoCodesAlpha2} = configureCountryIso({
iso: 'A2',
map: getMap()
});const {getIsoCodes: getIsoCodesAlpha3} = configureCountryIso({
iso: 'A3',
map: getMap()
});getIsoCodesAlpha2(50.95148037338329, 5.350969164113395); // returns [BE]
getIsoCodesAlpha3(50.95148037338329, 5.350969164113395); // returns [BEL]
```