Documentation

The /og/{style} endpoint renders a social-card image from a map style using the native MapLibre renderer. It defaults to 1200×630 — the size recommended by the OpenGraph protocol for og:image — so the output drops straight into a <meta property="og:image"> tag.

It reuses the same native rendering pipeline as Static Map Images; /og is a thin, social-card-shaped preset over it.

Basic Usage

GET /og/{style}?center={lat},{lng}&zoom={zoom}
# Default 1200x630 PNG centered on San Francisco
curl "http://localhost:8080/og/protomaps-light?center=37.8,-122.4&zoom=10" -o og.png

# Fit a bounding box instead of a center
curl "http://localhost:8080/og/protomaps-light?bounds=-122.5,37.7,-122.3,37.9" -o og.png

# JPEG output
curl "http://localhost:8080/og/protomaps-light?center=37.8,-122.4&zoom=10&format=jpeg" -o og.jpg

# WebP output
curl "http://localhost:8080/og/protomaps-light?center=37.8,-122.4&zoom=10&format=webp" -o og.webp

Use it in your page head:

<meta property="og:image" content="https://tiles.example.com/og/protomaps-light?center=37.8,-122.4&zoom=10" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />

Query Parameters

ParameterTypeDefaultDescription
centerstringlat,lng (e.g. 37.8,-122.4). Required if bounds is absent.
zoomnumber10Used with center.
boundsstringminLng,minLat,maxLng,maxLat. When present, overrides center.
widthu321200Image width in pixels. Capped at 4096.
heightu32630Image height in pixels. Capped at 4096.
formatstringpngOne of png, jpg, jpeg, webp.

Either center or bounds must be supplied; a request with neither returns 400.

Requires the Native Renderer

/og produces a rendered raster, so it needs the native MapLibre renderer and is gated by server.disable_render — exactly like /styles/{style}/static/.... When disable_render = true, the route is not registered and returns 404.

[server]
disable_render = true  # /og and /styles/{style}/static/... are removed

Limits

  • Maximum dimensions: 4096×4096 pixels (enforced by the shared render options validator).
  • Default format is PNG; jpg/jpeg/webp are also supported.