> ## Documentation Index
> Fetch the complete documentation index at: https://radarlabs-jasonliu-test.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Static Maps

> The Radar Static Maps API generates standalone images of Radar Maps that can be easily embedded anywhere an image can be used. These images can be created without the use of Javascript or any additional mapping libraries.

For example, here's a Radar Static Map displaying a marker for Radar HQ:

```html theme={null}
<img src="https://api.radar.io/maps/static?width=910&height=320&center=40.73430,-73.99110&zoom=15&style=radar-default-v1&scale=2&markers=color:0x000257|40.73430,-73.99110&publishableKey=prj_live_pk_..." alt="Radar static map over New York City" />
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=74aa6f334c61f83c466fa068a4ce3aa2" alt="Static Map Pn" width="1820" height="640" data-path="images/maps/static-map.png" />

## 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](/maps/maps#custom-styles) ID. See [map styles](/maps/maps#styles) for more details.                                                                   |
| `language`       | none                                                        | string (ISO code)                                                        | The display language for map. Can be any 2-letter [ISO Code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes), or `local` to use the device's specified language. Defaults to `en-US` if none is provided.               |
| `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](#markers) for more details.                                                                                                                                                           |
| `path`           | none                                                        | string                                                                   | For rendering paths on the map. See [paths](#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 a `markers` 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`.

```
markers=markerStyle|markerLocation1|markerLocation2|...
```

*markerLocation* are specified in the following format `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 format `0xFFFFFF` or a [standard color](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color). The default value if color is not specified is `0x000257`.
* `size` (string, optional): By specifying `size: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.

For instance, to apply a single marker styling to multiple pins:

```html theme={null}
https://api.radar.io/maps/static?width=900&height=600&style=radar-light-v1&scale=2&markers=color:0x000257|40.73430,-73.99110|40.706436,-73.997271&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-two-pins.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=c7468907265c15b335046a572efe68d9" alt="Static Map Two Pins Pn" width="1800" height="1200" data-path="images/maps/static-map-two-pins.png" />

Additionally, if you want more than one marker style in an image, you can provide multiple `markers` parameters in the request. `markers=markerStyle1|markerLocation1|...&markers=markerStyle2|markerLocation2|...`

An example request with two different styles is defined below.

```
https://api.radar.io/maps/static?width=900&height=600&center=37.80176,-122.42376&zoom=13&style=radar-dark-v1&scale=2&markers=color:0xD1F3E0|size:small|37.808387,-122.409673&markers=color:0xBFD1FF|37.822503,-122.478923&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-two-pins-different.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=51a8c829f592cee744a439ef55233898" alt="Static Map Two Pins Different Pn" width="1800" height="1200" data-path="images/maps/static-map-two-pins-different.png" />

### Paths

Paths lines can be added to highlight routes or connect items on your map. The `path` 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`.

```
path=pathStyle|pathLocation1|pathLocation2|...
```

*pathLocation* are specified in the following format `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).

```
path=pathStyle|enc:g{rwFnlrbMkArDENGRiCfIEJCJHFpA|@VPHFDOBGdC_IFQDO|BiHHUJBb@FxARLBH@
```

*pathStyle* are specified in the following format `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 format `0xFFFFFF` or a [standard color](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color). The default value if color is not specified is `0x000257`.
* `width` (number, optional): The width of the path in pixels. The default is `3`.
* `border` (string, optional): The color of the path border as a hex in the following format `0xFFFFFF` or a [standard color](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color). The default value if color is not specified is `white`.
* `borderWidth` (number, optional): The width of the border in pixels. The default is `2`.

```html theme={null}
https://api.radar.io/maps/static?width=900&height=600&style=radar-light-v1&scale=2&path=stroke:0xFF0000|width:3|border:0xFFFFFF|borderwidth:2|40.715442411463755,-74.01477925566485|40.71536228528052,-74.0135811740668|40.70948610234797,-74.01499068182932|40.70491834742046,-74.01675256653202|40.701953145830515,-74.01583638648677|40.70120514620143,-74.0143916410303|40.701819575084386,-74.01051549468332|40.70409024134315,-74.006357446784|40.706975211514106,-74.00167083347398|40.70871147591237,-73.99786516251531|40.709405968996606,-73.99455281927393|40.70961965771903,-73.99289664765297|40.71023400897673,-73.9875052804617|40.710901775653895,-73.9812682086125|40.711168880450145,-73.97918918466307|40.712798196502035,-73.97735682457207|40.71418709018175,-73.97682825916088|40.71765919762373,-73.97527780062218|40.72105100464597,-73.97464352212923|40.72334772071008,-73.97407971902413|40.72513696783835,-73.97267021126159|40.727032983196096,-73.97185974429856|40.728501692329786,-73.97566548297984|40.72588470062763,-73.97763879384702|40.72460287122638,-73.97837878542222|40.725671064108695,-73.98077494861835&path=|stroke:0x000257|width:3|border:0xFFFFFF|borderwidth:2|40.70376498115374,-73.98661916459334|40.700657698018915,-73.98670300220783|40.70003622399656,-73.9863583364594|40.70003622399656,-73.98677752453152|40.70514908788235,-73.98957211168081|40.71508654363487,-73.99501313325952|40.71646714228771,-73.99607566267477|40.72020611986693,-73.99421623619756|40.71750257248871,-73.98518473616696|40.71128974971751,-73.96465514996301|40.71005286858238,-73.9601393999477|40.710486585375435,-73.95607565049288|40.71330547192764,-73.95433006645362|40.71577909038294,-73.95155990047758|40.71934554124928,-73.95243269249747&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-paths.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=a4147bf114b5cce8f740f2fb039a48e9" alt="Static Map Paths Pn" width="1800" height="1200" data-path="images/maps/static-map-paths.png" />

## 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

We can specify these options as query parameters in the image `src`.

```html theme={null}
https://api.radar.io/maps/static?width=900&height=600&center=43.64259,-79.387087&zoom=13&style=radar-default-v1&scale=2&markers=color:0x000257|43.64259,-79.387087&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-embed.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=93e9bab902ac427298e95352cac06e89" alt="Static Map Embed Pn" width="1800" height="1200" data-path="images/maps/static-map-embed.png" />

### 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 the `center` 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.

```html theme={null}
https://api.radar.io/maps/static?width=900&height=600&style=radar-default-v1&scale=2&markers=color:0xFF428E|40.781196,-73.974075|40.782938,-73.959041&markers=color:0xE2052C|size:small|40.779344,-73.962486|40.76144,-73.977597|40.753664,-73.981905&path=stroke:0x000257|width:3|border:white|borderwidth:2|enc:qwwwF|cqbMIG@CBIMKIEeBiAKIKGeBkAIGMIs@e@q@c@IGKGeBgAKGMIcBiAECECKIGEw@g@c@YKGKIcBiAMIKGIGa@Wy@i@AAIGIEgBkAGESMAAi@]u@g@QKSOiAs@[UOKKGeBeASKHW[EEGOSEKIOEQAMOa@W]WQYQMIKKKKIMUg@COGc@GUIYU]W]]g@MSGGGCGAIAGEGKEKIKIIGGEKEOEOEKEIGIGEQKKEMIQKMIKGCYAOIMCIAG?G@G@K@I?GAI?GMQ?GM_@EUCOCQ?MAK?S?U?K@K@I@I@IBI@IBGBKBGBGDKDIDK@EBIHQDOBSBQ?O?Q?MAOAMAMEOIUEMKSIQGMS]EGMKSMc@UKEWGIESKUMOMSSQWMSKUMYM_@KYKUIWKSEKIMKMGIMMMKWOSMQGQI@G@IF_@QO[SSSMMGEEMCOAS@QD[RaAb@yAJWQKSMkBoAGEKGiBmAIEIGgBkAKGIGiBmAIGMGa@YgAs@IGGEgBkAKGKImAw@]UOKUOk@_@[SIEWQCCCCMGFSj@gB&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-autofit.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=c47d5234146334c60ccaa3a708376226" alt="Static Map Autofit Pn" width="1800" height="1200" data-path="images/maps/static-map-autofit.png" />

### Using a custom marker image

To use a custom marker image, set the `icon:` option as a URL that resolves to a valid `.png` or `.svg` file.

Note: images will be capped at 64 x 64 pixels.

```html theme={null}
https://api.radar.io/maps/static?width=900&height=600&style=radar-default-v1&scale=2&markers=icon:https://radar.com/static/image/logo.png|40.73430,-73.99110&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-custom-marker.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=6b3e45779a2378dae1a393a0ed2d7efc" alt="Static Map Custom Marker Pn" width="1800" height="1200" data-path="images/maps/static-map-custom-marker.png" />

### Rendering a route

Radar [Routing API](/api#routing) 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.

```html theme={null}
https://api.radar.io/maps/static?width=900&height=600&style=radar-light-v1&scale=2&markers=size:small|icon:https://radar.com/static/image/maps/map-pin-origin@3x.png|40.70425,-73.9865&markers=size:small|icon:https://radar.com/static/image/maps/map-pin-destination@3x.png|40.73412,-73.99128&path=borderwidth:2|border:0xFFFFFF|width:3|stroke:0x000257|enc:g{rwFnlrbMkArDENGRiCfIEJCJHFpA|@VPHFDOBGdC_IFQDO|BiHHUJBb@FxARLBH@l@HbANB?LDJF@@vAfAJHHF|AnAHFHHhA|@RNJJ|@r@LJJFHHh@`@p@h@JJJF~ApAJHFFzAlADDHFJHbAx@^XJHHHrB~ADDBBJFl@f@@@ZVb@%08Av@LJVRBURsAN}@BQ@K?AN_AFWDUPq@BMBKj@wBBMDMh@sBBMBMTy@Pu@BIDQPDd@NnATtBh@`@Ll@NJBD@`Cl@HBFBjBj@D@JBHBTFx@TJDVFTF`@LZAnA`@JBJDlDfALDLD~@`@fAd@hAf@JFHDjBbAJD@@LFj@ZJFVLZQtA}@ZUHGJKHKV]HKFIHIFGJIHGLILGjAg@t|Aks@H?JCJCRIFEHCHCH?FAF@F@HBFDFHDHBJ@L@JALAJCHEFEHE@C@C@I@I?I@G@I@KAc@AeACy@AG?I@KBODIBGBOF}@b@OFBgA?IM?Q?_@Ai@Cs@AI?I@K?yCKK?MAsAC_@AG?IAmBEI?[A&publishableKey=prj_live_pk_...
```

<img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-routing.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=07f2ecdb393533dd62d85be0ff2baf47" alt="Static Map Routing Pn" width="1800" height="1200" data-path="images/maps/static-map-routing.png" />

### 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.

The `scale` 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.

```html theme={null}
https://api.radar.io/maps/static?width=200&height=200&center=40.71257,-74.00260&zoom=12.5&style=radar-default-v1&scale=2&publishableKey=prj_live_pk_...
```

| 200x200 @ 1x scale                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | 200x200 @ 2x scale                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-high-res-1x.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=629d6fe4fe95fd8ffb922d160990bfd7" alt="Static Map 1x scale" width="200" height="200" data-path="images/maps/static-map-high-res-1x.png" /> | <img src="https://mintcdn.com/radarlabs-jasonliu-test/1vO2BAaEZjVTLZML/images/maps/static-map-high-res-2x.png?fit=max&auto=format&n=1vO2BAaEZjVTLZML&q=85&s=fd203c6c10cbe5e1fe33e2ed8f196f62" alt="Static Map 2x scale" width="400" height="400" data-path="images/maps/static-map-high-res-2x.png" /> |

## Coverage

See [Maps coverage](/maps/maps#coverage) for more details.

## Support

Have questions? We're here to help! Contact us at [radar.com/support](https://radar.com/support).
