There's a lot of open issues
A long-lived project that still receives updates
google-map-static-image-generator is a Ruby wrapper around the Google Maps Static API that generates PNG map images on the fly — no JavaScript required. Features: - Add custom markers at any coordinates - Draw paths with custom weight and colour - Apply map styles (hide labels, change colours, etc.) - Set center + zoom for marker-free maps - Choose map type: roadmap, satellite, terrain, or hybrid - Default 1024x1024 at scale 2 (retina-friendly) - Raises GoogleMapStaticImage::ApiError on non-200 responses (invalid key, quota exceeded, etc.) Useful for generating map thumbnails in emails, PDFs, admin dashboards, and anywhere an interactive JavaScript map is not practical.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.12
~> 3.0

Runtime

>= 0.14
 Project Readme

google-map-static-image-generator

A Ruby gem that wraps the Google Maps Static API to generate customizable static map images in Rails applications.

Installation

Add this line to your Gemfile:

gem 'google-map-static-image-generator'

Then run:

bundle install

Usage

map = GoogleMapStaticImage.new

response = map.get_response(
  "YOUR_GOOGLE_API_KEY",
  markers,           # array of marker coordinate strings
  style:    { feature: "all", element: "labels", visibility: "off" },
  path:     { weight: 3, color: "blue" },
  location: { lat: "48.8584", lng: "2.2945" },
  markers:  [["48.8584,2.2945"], ["48.8606,2.3376"]]
)

The response is the raw parsed response from the Google Static Maps API — typically image binary data or a redirect URL depending on your usage.

Options

Option Description
style Map style rules as a hash (key: value pairs joined with |)
path Path styling options (weight, color, etc.)
location Hash of lat/lng to append to the path
markers Array of marker groups; each group is an array of coordinate strings

The default image size is 1024x1024 at scale 2.

Dependencies