🗺️ A lightweight Node.js module to get the latitude and longitude for any fuzzy place name using the Google Places API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
gulpfile.js
index.coffee
index.js
package.json

README.md

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