ScreenshotNeo

BlogHow-to

Google Maps Screenshot API

Use Maps Static API for parameterized map images, or a browser screenshot API when you need pixels from a rendered Google Maps page.

By the ScreenshotNeo team1 October 20267 min read

Short answer: Google Maps Screenshot API usually means the Google Maps Platform Maps Static API. You send an HTTPS request containing a center, zoom, size, map type and optional markers; Google returns a map image. It is ideal for a parameterized map image, but it does not capture an arbitrary screenshot of the interactive Google Maps consumer site.

If you need a screenshot of any rendered webpage (including a map page), use a browser capture service such as ScreenshotNeo instead. The sections below show both approaches.

1. Choose the right API

Need Use Why
Fast map image with known coordinates and markers Maps Static API Returns an image directly; no JavaScript or browser required.
Pan, zoom, draggable markers or live controls Interactive Maps JavaScript API A static image cannot respond to user input.
Pixels from an arbitrary webpage, including consumer Maps UI Browser screenshot API Renders the page, waits for it to load and captures the result.

2. Set up Google Maps Static API

  1. Create or select a Google Cloud project and attach a billing account.
  2. Enable Maps Static API for that project.
  3. Create credentials (normally an API key; use the authentication method required by your project).
  4. Restrict the key to the Maps Static API and the servers or apps that will use it. Never publish a live unrestricted key in client-side source.

Google documents the request format in its overview. Requests must use HTTPS, and user supplied values must be encoded correctly. The documented URL limit is 16,384 characters, so long marker or path lists should be shortened or split.

3. Build a static map request

The essential parameters are:

Parameter Purpose Example
center Latitude/longitude or a place string. 40.7484,-73.9857
zoom Detail level; higher values show a smaller area. 15
size Image width and height in pixels. 640x400
maptype Visual style such as roadmap, satellite, terrain or hybrid. roadmap
markers One or more pins; repeat the parameter for groups with different styles. markers=color:red|40.7484,-73.9857
path Draws a line or polygon using encoded points. path=color:0x0000ff|40.7,-74.0|40.75,-73.9
key Your API key. key=YOUR_API_KEY
signature Digital URL signature when required by your account and deployment. signature=...

Example request (replace the key):

https://maps.googleapis.com/maps/api/staticmap?center=40.7484,-73.9857&zoom=15&size=640x400&maptype=roadmap&markers=color:red%7C40.7484,-73.9857&key=YOUR_API_KEY

cURL

curl -G 'https://maps.googleapis.com/maps/api/staticmap' \
  --data-urlencode 'center=40.7484,-73.9857' \
  --data-urlencode 'zoom=15' \
  --data-urlencode 'size=640x400' \
  --data-urlencode 'maptype=roadmap' \
  --data-urlencode 'markers=color:red|40.7484,-73.9857' \
  --data-urlencode 'key=YOUR_API_KEY' \
  -o map.png

Python

import requests

params = {
    "center": "40.7484,-73.9857",
    "zoom": 15,
    "size": "640x400",
    "maptype": "roadmap",
    "markers": "color:red|40.7484,-73.9857",
    "key": "YOUR_API_KEY",
}
r = requests.get("https://maps.googleapis.com/maps/api/staticmap", params=params, timeout=30)
r.raise_for_status()
with open("map.png", "wb") as f:
    f.write(r.content)

Node.js

const params = new URLSearchParams({
  center: '40.7484,-73.9857',
  zoom: '15',
  size: '640x400',
  maptype: 'roadmap',
  markers: 'color:red|40.7484,-73.9857',
  key: process.env.GOOGLE_MAPS_API_KEY
});
const res = await fetch(`https://maps.googleapis.com/maps/api/staticmap?${params}`);
if (!res.ok) throw new Error(`Maps Static API returned ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('map.png', buffer);

4. Add markers, paths and styling safely

  • Use multiple markers parameters for separate colors or labels. Encode the pipe character (|) when constructing URLs yourself.
  • Use path for routes, boundaries or polygons. For many points, use Google’s encoded polyline format to stay below the 16,384-character limit.
  • Use scale=2 for a denser retina image when your layout can display it at half the CSS size. Confirm the resulting dimensions and account limits before relying on it.
  • Keep attribution visible. Google’s policy requires clear, legible Google Maps attribution (use the supplied logo where possible; “Google Maps” text is acceptable when space is limited). Do not crop, obscure or alter it.

Validate latitude (−90 to 90), longitude (−180 to 180), positive zoom and a supported size before making the request. Treat place names as user input and URL encode them.

5. Authentication, quotas and cost

Maps Static API is pay-as-you-go. Billing must be enabled and each request must carry the required API key or OAuth token. Google’s usage documentation lists a documented ceiling of 30,000 queries per minute and standard image dimensions up to 640×640 pixels; larger-image guidance is separate. Configure daily quotas so an accidental loop stops instead of consuming an unlimited budget. Prices, included credits and account limits can change, so check the current billing page before publishing a cost figure.

Cache identical requests in your application, debounce map previews and avoid regenerating an image on every page refresh. A cache key should include every visual parameter (center, zoom, size, type, markers, paths, scale and style) plus the API version or signing configuration.

6. Attribution and regional terms

Keep Google attribution attached to every displayed map image. If your layout trims the image, reserve space for the attribution instead of placing it under an opaque overlay. Developers with an EEA billing address should read the regional terms in the official overview: EEA terms apply from 8 July 2025 and some Maps Static API content may no longer be returned.

7. When you actually need a webpage screenshot

Maps Static API produces a map image from parameters. It does not render the consumer Google Maps website, your own map application, cookie dialogs or other browser UI. A browser screenshot workflow must launch a browser, navigate to a URL, wait for the page and fonts, optionally dismiss overlays, then capture a viewport or full page.

Minimal Playwright example (Node.js)

import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1280, height: 800 }, deviceScaleFactor: 1 });
await page.goto('https://www.google.com/maps', { waitUntil: 'networkidle', timeout: 60000 });
await page.screenshot({ path: 'maps-page.png', fullPage: true });
await browser.close();

For production, add a bounded navigation timeout, wait for a selector that proves the map is ready, handle consent flows lawfully, and record whether the result was a successful page or an error page. Do not automate around bot checks or access controls.

8. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF. See the API documentation for all options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://www.google.com/maps -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://www.google.com/maps"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://www.google.com/maps' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Before capture, ScreenshotNeo can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the verdict and billing with X-Page-Verdict and X-Billed headers. It also offers an MCP server for Claude, Cursor and other MCP clients, with take_screenshot, get_page_info and capture_pdf tools. Free accounts include 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Start with the free ScreenshotNeo plan.

9. Troubleshooting

Symptom Likely cause Fix
403 or “This API project is not authorized” API not enabled, key restriction mismatch or billing disabled. Enable Maps Static API, check restrictions and billing, then retry with the intended key.
400 or malformed image request Unencoded separators, invalid coordinates, size or zoom. Build parameters with a URL encoder, validate values and inspect the final URL.
Image is cropped or too small Static image dimensions or viewport do not match the layout. Use a supported size, consider scale=2, or use a browser screenshot for a larger rendered page.
Markers or paths missing Pipe characters, labels or polyline data were encoded incorrectly. Use --data-urlencode or URLSearchParams; test one marker before adding a long path.
Quota errors or sudden spend Traffic spike, refresh loop or quota reached. Add caching and backoff, set daily quotas and monitor usage.
Browser screenshot contains a consent popup The page requires an interaction before capture. Wait for the banner and click its allowed consent control, or use ScreenshotNeo’s consent-removal step.
Blank or incomplete browser capture Navigation timeout, lazy content or map tiles still loading. Increase the bounded timeout, wait for a meaningful selector, scroll to trigger lazy loading and capture only after readiness.

10. Performance and reliability checklist

  • Set connect and total request timeouts; retry only transient 429 and 5xx responses with exponential backoff.
  • Do not retry authentication or validation errors unchanged.
  • Cache deterministic map images and serve them through your own CDN.
  • Log status, request parameters without secrets, response size, latency and quota headers.
  • For browser captures, reuse a browser process, cap concurrency, block unnecessary resources only when they cannot change the result, and keep a fallback image.
  • Verify attribution after any resize or crop step.

11. FAQ

Is there a single “Google Maps screenshot API” endpoint?

The documented product matching that phrase is Maps Static API. It returns a generated map image, not a screenshot of arbitrary Google Maps pages.

Can I use a Maps Static image in an email or PDF?

Yes, if your use follows Google Maps Platform terms and keeps required attribution. Generate the image server-side and retain the attribution in the rendered output.

What should I use for an interactive map?

Use an interactive Maps JavaScript implementation; a static image cannot support pan, zoom or click behavior.

How do I capture a map page for an AI agent?

Use a browser screenshot service with an MCP interface. ScreenshotNeo exposes screenshot, page-info and PDF tools through its MCP server.