Skip to content

Instantly share code, notes, and snippets.

@D3MZ
Created August 21, 2013 15:19
Show Gist options
  • Save D3MZ/6295839 to your computer and use it in GitHub Desktop.
Save D3MZ/6295839 to your computer and use it in GitHub Desktop.
require 'httparty'
require 'pp'
API_KEY = 'string'
#outputs filesize in bytes
module StreetView
include HTTParty
def self.image location
File.open(ENV['HOME']+"/#{location}.jpeg", 'w') { |file| file.write get('http://maps.googleapis.com/maps/api/streetview', :query => {:size => '1200x1200', :location => location, key: API_KEY, sensor: false}) }
end
end
StreetView.image '241 Spadina Ave Toronto, ON M5T 3A8' #=> 62489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment