Skip to content

Instantly share code, notes, and snippets.

@monteirobrena
Forked from jtadeulopes/download_map.rb
Created July 25, 2014 03:10
Show Gist options
  • Save monteirobrena/748eb99b59bc83c38906 to your computer and use it in GitHub Desktop.
Save monteirobrena/748eb99b59bc83c38906 to your computer and use it in GitHub Desktop.
require 'open-uri'
url = 'http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&markers=color:0x4E3253%7C40.714728,-73.998672&zoom=15&size=640x640&scale=2&format=png&maptype=roadmap&sensor=false'
target = File.join(File.expand_path('../', __FILE__), '/maps.jpg')
File.open(target, "wb") do |saved_file|
open(url, 'rb') do |read_file|
saved_file.write(read_file.read)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment