//View Tip #872
Similar Tips
» Change extension of files in the current directory
» SSH Auto Complete
» Change prompt color dynamically
» Keeping your Home Directory Organized
» CDPATH

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
The following bash script, which depends on lynx web browser, uses Google's reverse geocode service to find a nearby address given a latitude and longitude pair:

#!/bin/bash
# findnearest
# Usage: findnearest latitude longitude
# Ex.  findnearest  17.976227 -66.111016

lat=$1
long=$2
result=$(lynx -dump "http://maps.google.com/maps/geo?output=csv&oe=utf-8&ll=$lat,$long")
echo $result | cut -f3- -d,


View Comments »




Comments 

Add your comment

Comments are currently disabled
Coornail
Modified a bit to work with wget:

#!/bin/bash
# findnearest
# Usage: findnearest latitude longitude
# Ex.  findnearest  17.976227 -66.111016
lat=$1
long=$2
wget -q "http://maps.google.com/maps/ge … f-8&ll=$lat,$long" -O -|cut -f3- -d,
Posted 2009-08-19 10:38:36
@Coornail: thanks for the wget-version. it's nicer to look at.
Posted 2009-08-19 14:43:35
Pleurastic
Only located city.  Should I have expected a street address?  Fun stuff here at shell-fu.org
Posted 2009-08-27 12:15:31
exec 3<>/dev/tcp/maps.google.com/80
echo -e "GET /maps/geo?output=csv&oe=utf8&ll=$lat,$long HTTP/1.1\n\n">&3
cat <&3
Posted 2009-12-01 12:33:50

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit