Created
August 14, 2012 00:34
-
-
Save dustMason/3345154 to your computer and use it in GitHub Desktop.
The simplest geocoder ever. CLI thingy using node.js and the Google Maps API. Enter a place, get lat + lng
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt = require 'prompt' | |
gm = require 'googlemaps' | |
red = '\u001b[31m' | |
blue = '\u001b[34m' | |
reset = '\u001b[0m' | |
l = (content) -> | |
console.log content | |
prompt.start() | |
prompt.get('Place Name', (err, result) -> | |
loc = gm.geocode(result['Place Name'], (err, result) -> | |
l '----------------------------------------------' | |
l red + 'Found: ' + reset + result.results[0].formatted_address | |
l '----------------------------------------------' | |
l result.results[0].geometry.location.lat | |
l result.results[0].geometry.location.lng | |
l '----------------------------------------------' | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks bert! somehow i didn't see this comment until just now