πΊοΈ Static Maps API
Generate a map image from a single URL. Embed it in emails, reports, social cards, or any server-rendered page β no JavaScript needed.
PNG & JPEG
Markers
Polylines
GeoJSON overlay
Auto bbox fit
6 Map styles
β¨ Live Demo
πΊοΈ
Enter your API key and click Generate
β
π Endpoint
GET
https://api.latlng.work/v1/static
Returns a image/png or image/jpeg response directly. Suitable for use in <img src="..."> tags.
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
key * | string | β | API key via query param or X-Api-Key header |
center | string | β | lng,lat β required unless using bbox |
zoom | number | β | Zoom level 0β20 β required unless using bbox |
bbox | string | β | minLng,minLat,maxLng,maxLat β auto-fits zoom to bounds |
width | integer | 800 | Image width in pixels (max 2048) |
height | integer | 600 | Image height in pixels (max 2048) |
style | string | dark | light Β· dark Β· grayscale Β· black Β· white Β· contrast |
format | string | png | png or jpeg |
markers | string | β | Pipe-separated: lng,lat,color,label|lng,lat,color,label |
path | string | β | Polyline: weight:color:opacity|lng,lat|lng,lat|β¦ (repeatable) |
geojson | string | β | URL-encoded GeoJSON to overlay |
π» Code Examples
# Simple city center https://api.latlng.work/v1/static?center=-74.006,40.7128&zoom=12&width=800&height=400&style=dark&key=YOUR_KEY # Auto-fit to New York City bounding box https://api.latlng.work/v1/static?bbox=-74.25,40.49,-73.7,40.92&width=1200&height=600&style=light&key=YOUR_KEY # With a marker https://api.latlng.work/v1/static?center=-74.006,40.7128&zoom=14&markers=-74.006,40.7128,22c55e,A&key=YOUR_KEY
const params = new URLSearchParams({
center: '-74.006,40.7128',
zoom: '12',
width: '800',
height: '400',
style: 'dark',
key: 'YOUR_KEY'
});
// Use in an img element
const img = document.getElementById('my-map');
img.src = `https://api.latlng.work/v1/static?${params}`;
// Or fetch as a blob
const response = await fetch(`https://api.latlng.work/v1/static?${params}`);
const blob = await response.blob();
const url = URL.createObjectURL(blob);import requests
params = {
'center': '-74.006,40.7128',
'zoom': 12,
'width': 800,
'height': 400,
'style': 'dark',
'key': 'YOUR_KEY'
}
response = requests.get('https://api.latlng.work/v1/static', params=params)
with open('map.png', 'wb') as f:
f.write(response.content)
# With a marker
params['markers'] = '-74.006,40.7128,22c55e,NYC'
response = requests.get('https://api.latlng.work/v1/static', params=params)<!-- Simple embed --> <img src="https://api.latlng.work/v1/static?center=-74.006,40.7128&zoom=12&width=800&height=400&key=YOUR_KEY" alt="Map of New York City" width="800" height="400" > <!-- With marker (anchor on a specific location) --> <img src="https://api.latlng.work/v1/static?center=-74.006,40.7128&zoom=14&markers=-74.006,40.7128,22c55e,A&key=YOUR_KEY" alt="Location map" >
π Common Use Cases
π§
Email templates
Embed a map showing an event location or delivery address directly in transactional emails.
πΌοΈ
Social sharing cards
Generate og:image previews with a map background for listings, events, or real estate.
π
PDF / reports
Include maps in server-rendered PDFs without a headless browser or Puppeteer.
β‘
Static sites
Show a location map without loading an interactive map library. Faster, no JS needed.
Get your free API key from the dashboard. Free plan includes 100 static map requests/day. Upgrade for 10,000/month on Pro.
π Attribution required: Map data is Β© OpenStreetMap contributors (ODbL). When embedding static map images in a public-facing application, you must display this attribution visibly near the map image β in a caption, footer, or overlay text.