Static map rendering with mapbox-gl. Renders a static map image from a mapbox-gl style, optionally overlaying GeoJSON data sent from the client.
Multiple styles are supported, and must be specified with a config file. For an example config file see backgrounds.json.
Request a map centered on a given coordinate, and a given zoom level.
/zoom/lon/latxwidth/height/background.format
Example /10.5/-111/45/200x200/default.png
Post data is optional.
Zoom levels are based on 512 pixel tiles, so they may be 1 off from expected.
Request a map of a specific geographic region.
"/bounds/widthxheight/background.format"
Bounds is in the formal W,S,E,N.
Example: /-110,44,-109,45/100x100/topo.png
Post data is optional.
Request a map of a region that covers POSTed GeoJSON data.
Example: /100x100/topo.png
Post data is required.
Extent is buffered 10% so data does not touch edges of map.
Styling is based on the simplestyle spec. All keys are supported except marker-symbol
.
The following image formats are supported:
- png
- jpg or jpeg
- webp
jpeg and webp can also specify a quality level, one of:
- 70
- 80
- 90
- 100
For example .jpg90
curl -d '{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-111.37939453125,44.61393394730626]}}' -H 'Content-Type: application/json' http://localhost:3000/100x100/default.png