Skip to content

Instantly share code, notes, and snippets.

Created July 2, 2014 16:08
What would you like to do?
Uses get-location/CoreLocation on a Mac and Google's geocoding API to tell you the street address of your current location
# So you know whoami, but whereami?
# Relies on this handy hack <>
latlong=$(/usr/local/bin/get-location 2> /dev/null \
| sed -e 's/.*<\(.*\)>.*/\1/')
address=$(curl -Ss "$latlong&sensor=false" \
| grep formatted_address \
| head -n 1 \
| sed -e 's/[ \t]*"formatted_address" : "\(.*\)",/\1/')
echo "You're at $address"
Copy link

ttscoff commented Jul 2, 2014

You'll need get-location (and the Command Line Tools to compile it) to make this work. It's cool when it does, though.

Copy link

sjsyrek commented Jul 8, 2014

Installed. A little slow and slightly off, but I only have 2 GB of RAM on this 2009 MBA, and I live in Manhattan. Got this output (with numbers X'ed out):

You're at "formatted_address" : "XX West XXth Street, New York, NY XXXXX, USA",

Is that correct? Seems somewhat contrary to your intentions. Thanks for the neat tool, though!

Copy link

@ttscoff get-location seems to not work on Yosemite. Not expecting compatibility at this point, and it's not even a tool you wrote, but any suggestions? Seems like a fun script.

Copy link

ttscoff commented Jul 27, 2014

@sjsyrek must be a difference in the output for you. I just did a quick regex with sed based on the only address I was working with. I'll try and test with some other output.

@CameronBangs I haven't tried it, but it can't be too tough to fix. CoreLocation still exists and it's not a complex program. Maybe @lindes will have a chance to take a look before the release…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment