Skip to content

Instantly share code, notes, and snippets.

@EtienneLem
Created April 1, 2013 20:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EtienneLem/5287461 to your computer and use it in GitHub Desktop.
Save EtienneLem/5287461 to your computer and use it in GitHub Desktop.
Static Google Maps Image
require 'uri'
address = '335 Rue Saint-Joseph Est, Quebec City, QC'
marker_color = '4fc27d'
args = {
markers: "color:0x#{marker_color}|#{address}",
size: '640x330',
zoom: 14,
language: 'en',
sensor: false,
scale: 2 # @2x image
}
query = URI.encode_www_form(args)
path = "http://maps.googleapis.com/maps/api/staticmap?"
puts "#{path}#{query}"
# => http://maps.googleapis.com/maps/api/staticmap?markers=color%3A0x4fc27d%7C335+Rue+Saint-Joseph+Est%2C+Quebec+City%2C+QC&size=640x330&zoom=14&language=en&sensor=false&scale=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment