Skip to content

Instantly share code, notes, and snippets.

@jtadeulopes
Created July 24, 2014 18:09
Show Gist options
  • Save jtadeulopes/9e7fc63bc9c3c4ac8084 to your computer and use it in GitHub Desktop.
Save jtadeulopes/9e7fc63bc9c3c4ac8084 to your computer and use it in GitHub Desktop.

Revisions

  1. jtadeulopes created this gist Jul 24, 2014.
    10 changes: 10 additions & 0 deletions download_map.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    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