Created
April 3, 2013 03:32
-
-
Save dannvix/5298241 to your computer and use it in GitHub Desktop.
convert latitude & longitude with Geocoder (Google Maps API)
This file contains 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
#!/usr/bin/env ruby | |
require "geocoder" | |
def latlng_to_addr (lat, lng) | |
query_result = Geocoder.search("#{lat},#{lng}") | |
return query_result.first.formatted_address | |
end | |
if ARGV.length < 2 | |
puts "usage: ./#{$0} <latitude> <longitude>" | |
exit(1) | |
end | |
lat, lng = ARGV[0], ARGV[1] | |
formatted_address = latlng_to_addr(lat, lng) | |
puts formatted_address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment