Skip to content

Lightning fast longitude and latitude lookup for country and state codes

License

Notifications You must be signed in to change notification settings

angleman/geos-major

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geos-major NPM version Dependency Status

Lightning fast longitude and latitude lookup for country and state codes.

Install

npm install geos-major --save

Country Lookup

var geos = require('geos-major')
  , geo = geos.country('us');
console.log(geo); /* results:  
    countryCode: 'US',
    countryName: 'United States',
    currency: 'USD,USN,USS',
    continent: 'Americas',
    subContinent: 'Northern America',
    phoneCode: '1',
    latitude: 38,
    longitude: -97
} */

CloudFlare Lookup

var geos = require('geos-major')
  , cf_country = req.headers['cf-ipcountry']
  , geo = geos.country(cf_country); // accessed from the USA
console.log(geo); // countryCode: 'US', countryName: 'United States', ...

State Lookup

Includes regions: AA, AE, AP, AS, FM, GU, MH, MP & PR

var geos = require('geos-major')
  , geo = geos.state('TX');
console.log(geo); // { "name":"Texas", "latitude": 31.1060, "longitude": -97.6475 }

Major attributions

License: MIT

About

Lightning fast longitude and latitude lookup for country and state codes

Resources

License

Stars

Watchers

Forks

Packages

No packages published