
How it works
To generate an image with Radar’s Static Maps API, simply make an HTTP request with your desired map size, location, and any markers (map pins) for highlighting important features. Static Map images can be used inline with HTML<img>
tags by setting the src
attribute to the Static Maps endpoint.
Configuration
Definition
GET
https://api.radar.io/maps/static
Parameters
Name | Default | Possible values | Description |
---|---|---|---|
width | none (required) | number | The width of the image in pixels as a number between 100 and 2048 . |
height | none (required) | number | The height of the image in pixels as a number between 100 and 2048 . |
center | none (required, unless markers are provided) | string | The coordinates specified in latitude,longitude format for the center of the map. If center is not provided then the map will be centered to visibly fit all markers in view. |
zoom | none (required, unless bbox, markers, or path are provided) | number | The zoom position of the map which is a number between 1 and 23 . If zoom is not provided then the map will fit the view to the markers. |
scale | 1 | number | The scale or resolution of the map as a number between 1 and 3 . This is useful for high-density displays and will affect the width and height parameters by returning an image that is the product of the width/height and scale. |
style | radar-default-v1 | radar-default-v1 , radar-light-v1 , radar-dark-v1 , CUSTOM_STYLE_ID | The style of the map. One of Radar’s out-of-the box styles, or a custom style ID. See map styles for more details. |
bbox | none | string | The bbox or latitude and longitude bounds of the image. Specified as min_latitude,min_longitude,max_latitude,max_longitude . The image returned will fit the specified bounding box. |
markers | none | string | For rendering markers on the map. See markers for more details. |
path | none | string | For rendering paths on the map. See paths for more details. |
publishableKey | none (required) | string | Your Radar publishable API key. |
Markers
Adding markers (or map pins) to your static images can be useful for highlighting important features on your map. The Static Maps endpoint accepts amarkers
parameter that can be configured for rendering one, or many markers on the map.
Each markers parameter is made up of optional markerStyle
sections, and one or more markerLocations
.
latitude,longitude
and are pipe separated.
markerStyle are specified in the following format optionName:optionValue
and are pipe separated. markerStyle have the following options:
color
(string, optional): The color of the image specified as a hex in the following format0xFFFFFF
or a standard color. The default value if color is not specified is0x000257
.size
(string, optional): By specifyingsize:small
as an option, you can render a scaled down version of the marker.icon
(string, optional): The marker image to use. Can be a URL to valid SVG or PNG file, or the ID of custom uploaded marker. The default marker image will be used if not provided.

markers
parameters in the request. markers=markerStyle1|markerLocation1|...&markers=markerStyle2|markerLocation2|...
An example request with two different styles is defined below.

Paths
Paths lines can be added to highlight routes or connect items on your map. Thepath
parameter can be configured for rendering a connected list of coordinates or an encoded polyline.
Each paths parameter is made up of optional pathStyle
sections, an encoded polyline, or one or more pathLocations
.
latitude,longitude
and are pipe separated. Locations must come after the style options.
The locations can also be provided via encoded polyline by specifying enc:
as the option (or enc6:
for a polyline with 6 decimals precision).
optionName:optionValue
and are pipe separated. pathStyle have the following options:
stroke
(string, optional): The color of the path specified as a hex in the following format0xFFFFFF
or a standard color. The default value if color is not specified is0x000257
.width
(number, optional): The width of the path in pixels. The default is3
.border
(string, optional): The color of the path border as a hex in the following format0xFFFFFF
or a standard color. The default value if color is not specified iswhite
.borderWidth
(number, optional): The width of the border in pixels. The default is2
.

Examples
Embedding a Radar Static Map using HTML
Radar Static Maps can easily be embedded into<img>
using the element’s src
attribute. For instance, if we wanted an image of a map with the following attributes:
- width: 900
- height: 600
- center: 43.64259,-79.387087
- zoom: 13
- style:
radar-default-v1
- scale: 2
- marker:
- color:
0x000257
- location: 43.64259,-79.387087
- color:
src
.

Autofitting map bounds to markers or paths
When markers or paths are included as part of the Static Image request, you have the option for thecenter
and zoom
to automatically be determined based on the items’ locations.
By omitting the center
and zoom
parameters, the map’s position will be calculated to ensure all markers and paths are visible.

Using a custom marker image
To use a custom marker image, set theicon:
option as a URL that resolves to a valid .png
or .svg
file.
Note: images will be capped at 64 x 64 pixels.

Rendering a route
Radar Routing API responses include the shape of the route in either the polyine or LineString format. Both of these formats are supported for rendering a path, which can be used to plot the route in a static image.
Images for high resolution device
When embedding images on high resolution devices, images may look blurry (low resolution) or be too small if the image is not scaled to match the device’s pixel ratio. Thescale
parameter can be used to increase the resolution of an image, while keeping the same map area visible. For example an image with scale=2
will return an image that is two times the size, but at the same zoom/area.
200x200 @ 1x scale | 200x200 @ 2x scale |
---|---|
![]() | ![]() |