Build a URL to create a static map with polygon.

To display a polygon on a static map, use the /with-polygon endpoint from the ArcGIS Static Maps service. Provide an array of rings in the polygon parameter, where each ring is defined by 3 to 10 x,y coordinate pairs that form the polygon boundary. You can also specify the polygon fill and outline colors. Additionally, specify the image width and height in pixels, along with the output format (png, jpeg, or webp).

How to display a static map with a polygon

The typical workflow to display a static map with a polygon is:

  1. Map: Define the basemapStyle and map area with centerX andcenterY, and zoom or radius.
  2. Geometry: Define the polygon array containing the rings with x,y coordinate pairs that define the polygon.
  3. Image: Specify the image height and width in pixels, format, and attribution style.
  4. Request: Send a GET request to the /with-polygon endpoint to generate the static map.

Service URL

Use dark colors for code blocksCopy
1
https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps

Path parameters

These are required parameters to specify the style to access.

Use dark colors for code blocksCopy
1
https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/{basemapStyle}/with-polygon
NameDescriptionExample
{version}Required: The API version.v1
{basemapStyle}Required: The basemap style for the static map.arcgis/navigation, arcgis/navigation-night, arcgis/imagery, arcgis/streets-night, or arcgis/streets

Query parameters

NameTypeRequiredDefault valueDescription
tokenstring

An access token with the static maps service privilege. To pass the token as an authorization header, see HTTP authorization headers.

polygonRing

An array of x,y coordinate pairs in the WGS84 spatial reference defining a polygon boundary. Accepts 3 to 10 coordinate pairs.

fillColorHexColor007AC2

Polygon fill color in hexadecimal format.

fillStylestringsolid

Polygon fill style. Supported values include solid and none.

formatImageFormatwebp

Output image format of the map. Supported formats include png, jpeg, and webp.

heightImageDimensionHeight400

Height of the map image in pixels. Values must be between 128 and 1024.

widthImageDimensionWidth400

Width of the map image in pixels. Values must be between 128 and 1024.

outlineColorHexColor007AC2

Polygon outline color in hexadecimal format.

outlineStyleLineStylesolid

Polygon outline stroke. Supported values include solid, dash and dot.

outlineWidthinteger4

Polygon outline width in device-independent pixels. Values range from 1 to 16.

paddingImagePadding10

Padding percentages around the map extent. Accepts an array of 1–4 values; default is 10 on all sides, maximum is 25.

centerXnumber(double)

X-coordinate of the map center in WGS84 decimal degrees. Values range from -179.99 to 179.99.

centerYnumber(double)

Y-coordinate of the map center in WGS84 decimal degrees. Values range from -85.05 to 85.05.

zoomZoomLevel

A number that defines the level of detail of the map. Values range from 0 to 22.

radiusRadiusDistance

A number (in meters) that defines the minimum geographic area around a center point of the map. If no center point is supplied, the radius is applied to the geometry. Values range from 10 to 20,000,000.

attributionstringauto

Attribution footer style. To learn more about attribution requirements for static maps, see Esri and data attribution.

referenceDetailsstringall

A basemap option that controls the visibility of labels and feature symbology. This parameter is currently supported only for the arcgis/imagery style. Supported values include all and none.

Code examples

Display a polygon for a building footprint

Use the Static Maps service to display a static map with polygons highlighting the building footprints of Denver Health Hospital. This allows you to identify specific buildings and understand their layout. The map uses the ArcGIS Navigation basemap style.

Steps

  1. Reference the service.
  2. Set the API key in the Authorization request header using the Bearer authentication scheme.
  3. Define the polygon array, fill and outline colors, and other parameters for the request.
  4. Send the request to the Static Maps service to generate the static map.
JavaScript
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
        const res = await fetch(
          `https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/${basemapStyle}/with-polygon?fillStyle=solid&format=png&height=250&width=500&outlineStyle=solid&outlineWidth=2&polygon=${polygon}&centerX=-104.99188&centerY=39.726894&zoom=15&fillColor=00509f1A&outlineColor=003366c2`,
          {
            method: "GET",
            headers: {
              Authorization: `Bearer ${accessToken}`,
            },
          }
        );

        const blob = await res.blob();
        const mapEl = document.getElementById("parkMap");
        mapEl.src = URL.createObjectURL(blob);
        mapEl.style.display = "block";
Expand

REST API

cURLcURLHTTP
Use dark colors for code blocksCopy
1
2
curl -X GET \
'https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/arcgis/navigation/with-polygon?fillStyle=solid&format=png&height=250&width=500&outlineStyle=solid&outlineWidth=2&polygon=[[-104.9920565,39.7287284],[-104.9920565,39.7281439],[-104.9916087,39.7281439],[-104.9916087,39.7285822],[-104.9918903,39.7287962],[-104.9920565,39.7287284]]&centerX=-104.991326&centerY=39.7280192&zoom=15&fillColor=00509f87&outlineColor=003366c2&token=<ACCESS_TOKEN>'

Tutorials

Display a simple static map

Display a static map with a point, polyline, or polygon.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.