Static
A rendered map image or raster tile from a style. Both return image bytes,
so --output doesn't apply — redirect to a file. Static Images and Static
Tiles merged into this one command group; get-image and get-tile are
what were static-images get-static-image and static-tiles get-static-tile. Every command also takes the common flags —
--username/-u, --token/-t, --profile, --id — described in
Shared parameters.
mapbox static get-image
A map image centered on a point.
Parameters:
| Parameter | Description |
|---|---|
<style-id> | The ID of the map style to render. |
<overlay> | One or more overlay features to render on the map, separated by commas. The last item renders on top. The value must begin with geojson, pin-, path, or url-; otherwise the request returns 400. Supported overlay types: |
<lon> | Longitude of the map center. |
<lat> | Latitude of the map center. |
<zoom> | Zoom level. Fractional values are rounded to two decimal places. |
<bearing> | Bearing (rotation) of the map in degrees clockwise from north. Defaults to 0. |
<pitch> | Pitch (tilt) of the map in degrees. 0 is looking straight down; 60 is the maximum. |
<width> | Width of the output image in pixels. |
<height> | Height of the output image in pixels. |
<highRes> | Doubles the pixel density of the output image while keeping the same logical dimensions, for Retina displays. Pass an empty string for standard resolution. Values: @2x, ``. |
<format> | File extension that sets the output image format, appended directly after the dimensions and optional @2x (for example 600x400@2x.webp). Omit it to let the style decide: vector-only styles return PNG and raster-only styles return JPEG. Values: .png, .jpeg, .webp, ``. |
--attribution | Whether to include map attribution on the image. |
--logo | Whether to include the Mapbox logo on the image. |
--before-layer | ID of a style layer. When provided, overlays are inserted into the style directly below this layer. Useful for placing overlays beneath labels. |
--addlayer | A JSON object representing a Mapbox style layer to add to the map before rendering. Maximum one per request. Cannot be combined with setfilter. |
--setfilter | A JSON array representing a Mapbox GL filter expression to apply to an existing layer. Maximum one per request. Requires layer_id. Cannot be combined with addlayer. |
--layer-id | The ID of the style layer to which setfilter is applied. |
Examples:
mapbox static get-image streets-v12 "" 24.94 60.16 12 0 0 600 400 "" .png \
--username mapbox > map.png
mapbox static get-tile
One raster tile rendered from a style, rather than from a tileset (see
tilesets get-tile).
Parameters:
| Parameter | Description |
|---|---|
<style-id> | The ID of the map style to render. |
<tilesize> | Tile dimensions in pixels. 512 (default) produces 512 x 512 tiles; 256 produces 256 x 256 tiles. 512 px tiles at zoom z cover the same area as 256 px tiles at zoom z+1. Values: 256, 512. |
<z> | Zoom level (0-22). |
<x> | Tile column (x coordinate) per the slippy-map tile scheme. |
<y> | Tile row (y coordinate) per the slippy-map tile scheme. |
<highRes> | Doubles the pixel density of the output tile while keeping the same logical dimensions, for Retina displays. Pass an empty string for standard resolution. Values: @2x, ``. |
<format> | File extension that sets the output image format, appended directly after the tile coordinates and optional @2x (for example 6160@2x.webp). Omit it to let the style decide: vector-only styles return PNG and raster-only styles return JPEG. Values: .png, .jpeg, .webp, ``. |
Examples:
mapbox static get-tile streets-v12 512 2 1 1 "" .png \
--username mapbox > tile.png
このpageは役に立ちましたか?