place-lookup

1.0.1 • Public • Published

place-lookup

A lightweight Node.js module to get the latitude and longitude for any fuzzy place name using the Google Places API

Dependency Status devDependency Status Code Climate

Install

npm install place-lookup --save

Usage

var placeLookup = require('place-lookup');
var apiKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
 
placeLookup("oxford", apiKey, function(result){
    console.log(result) // Do whatever with the results
});

Results

{ 
    place_name: 'Paris, France',
    location: { lat: 48.856614, lng: 2.3522219 } 
}

How to get yourself a Google Places API key

  • Head over to The Google Developer Console
  • In the top-left corner select "New Project" from the projects dropdown.
  • In the API's menu, search for "Google Places API Web Service" and ensure it is set to enabled
  • On the Credentials pags: Add Credential --> Server Key --> Give it a name, (leave IP blank if your unsure). Click create
  • The 40-ish digit alpha-numeric code is your new key :)

License

MIT (C) Alicia Sykes

Readme

Keywords

none

Package Sidebar

Install

npm i place-lookup

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • lissy93