Rendering to PNG
One <img> tag. No JavaScript map, no client library. Good for newsletters, PDFs, Open Graph cards, Slack bots and anything that cannot run WebGL.
<img src="https://api.kart-api.se/v1/render/karta?lat=58.7052&lng=15.7803&zoom=13&w=600&h=340&marker=15.7803,58.7052"
width="600" height="340" alt="Map of Finspång">| Parameter | Meaning |
|---|---|
lat, lng, zoom | Centre and zoom. |
bbox | west,south,east,north instead of a centre. |
w, h | Image size in points, max 2000. |
scale | 1 or 2 (retina). Default 2. |
style | ljus (light) or morker (dark). |
marker | lng,lat. Repeat for several markers. |
pitch, bearing | Tilt and rotation. |
What to expect
- The first call can take up to ~20 seconds. The image is rendered in a real browser on our side. After that it is cached and comes back in milliseconds.
- At most two concurrent external renders. The render queue is shared with our own newsroom and takes one at a time. When it is full you get
429withRetry-Afterinstead of an image that never arrives. Need bulk? Talk to us rather than burning your quota. - The credit is burned into the image. Cropping it out breaks the licence.
Vignettes: the map that refuses to be half-finished
/v1/render/vinjett is an orientation image over a municipality or a point — the small map that shows *where in the country* something is.
curl -sD - -o vignette.png 'https://api.kart-api.se/v1/render/vinjett?kommun=0562&w=600&h=400'It is delivered only if it can be filled. If map coverage is missing you get 503 and the field lagsta_fyllande_zoom instead of an image with holes. The X-Fyllnad header (0–1) says how much of the image actually became map, and X-Ready whether rendering finished.
We once shipped half-finished images with 200 and no signal at all. That is the entire reason those two headers exist.