Created
May 17, 2009 00:12
-
-
Save mdoel/112853 to your computer and use it in GitHub Desktop.
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
desc "Use Google to get and XML geocode response for address" | |
task :geocode => :environment do | |
require 'geokit' | |
address_str = ENV['address'] | |
if address_str.nil? | |
puts "Usage: rake geocode address='address to geocode'" | |
end | |
url = "http://maps.google.com/maps/geo?q=#{Geokit::Inflector::url_escape(address_str)}&output=xml&key=#{Geokit::Geocoders::google}&oe=utf-8" | |
res = Net::HTTP.get_response(URI.parse(url)) | |
puts res | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment