Skip to content
Lightning fast longitude and latitude lookup for country and state codes
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
.travis.yml
Gruntfile.js
LICENSE
README.md
TESTS.md
geos-major.js
package.json

README.md

geos-major NPM version Build Status Dependency Status License

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

Install

npm install geos-major

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

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

Major attributions

License: MIT

Something went wrong with that request. Please try again.