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:
<img src="https://api.radar.io/maps/static?width=910&height=320¢er=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" />
#
How it worksTo 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#
DefinitionGEThttps://api.radar.io/maps/static
#
ParametersName | 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 markers 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. |
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. |
#
MarkersAdding 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 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.
For instance, to apply a single marker styling to multiple pins:
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_...
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¢er=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_...
#
PathsPaths lines can be added to higlight 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 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
.
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_...
#
Examples#
Embedding a Radar Static Map using HTMLRadar 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:
We can specify these options as query parameters in the image src
.
https://api.radar.io/maps/static?width=900&height=600¢er=43.64259,-79.387087&zoom=13&style=radar-default-v1&scale=2&markers=color:0x000257|43.64259,-79.387087&publishableKey=prj_live_pk_...
#
Autofitting map bounds to markers or pathsWhen 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.
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_...
#
Using a custom marker imageTo 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.
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_...
#
Rendering a routeRadar 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.
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_...
#
Images for high resolution deviceWhen 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.
https://api.radar.io/maps/static?width=200&height=200¢er=40.71257,-74.00260&zoom=12.5&style=radar-default-v1&scale=2&publishableKey=prj_live_pk_...
200x200 @ 1x scale | 200x200 @ 2x scale |
---|---|
#
CoverageSee Maps coverage for more details.
#
SupportHave questions? We're here to help! Contact us at radar.com/support.