1.1.0 • Published 9 years ago

city-to-coords v1.1.0

Weekly downloads
18
License
MIT
Repository
github
Last release
9 years ago

city-to-coords

Enter a city, get coordinates

npm.io js-semistandard-style

I wanted a simple way to get coordinates from a given location, and weather-js actually gives good coordinates quickly, so I decided to use that.

Please note that this requires node version 0.12 or higher.

Usage

Requiring the module and you will get a function which takes a city (or really, any location) and returns a promise with the latitude and longitude in an object, or an error.

import getCoords from 'city-to-coords';

getCoords('NYC')
  .then((coords) => {
    console.log(coords);
  });

Where coords is:

{
  lat: '40.782',
  lng: '-73.832'
}