Till innehållet

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">
ParameterMeaning
lat, lng, zoomCentre and zoom.
bboxwest,south,east,north instead of a centre.
w, hImage size in points, max 2000.
scale1 or 2 (retina). Default 2.
styleljus (light) or morker (dark).
markerlng,lat. Repeat for several markers.
pitch, bearingTilt and rotation.

What to expect

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.