Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Google Maps Static map helper for Ruby on Rails
module StaticMapHelper
def static_map_for(location, options = {})
params = {
:center => [, location.lng].join(","),
:zoom => 15,
:size => "300x300",
:markers => [, location.lng].join(","),
:sensor => true
query_string ={|k,v| "#{k}=#{v}"}.join("&")
image_tag "{query_string}", :alt =>
Copy link

joshuapinter commented Jul 17, 2017

Thanks for this! Ended up using it.

Copy link

codrinM58 commented Dec 20, 2021

Hey im looking for using something like this but adding a polygon in the map generated, is it possible ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment