Manage map tile cache

The cache settings for a hosted map tile layer (item) can be used to control the map tile service cache.

The tile settings allow you to:

  • Set the minimum and maximum scales at which a hosted map tile layer draws when added to a map.
  • Manage the scale levels at which tiles are built.
  • Define how tile updates are managed: manually or automatically to reflect changes to feature data.
  • Allow tiles to be used in offline maps and apps.
Item page service
Map tile service item settings page in ArcGIS.com.

What is a map tile cache?

Map tile services published to and hosted in ArcGIS support fast visualization of large datasets using a collection of pre-generated map tiles. Map tiles are stored in an image format, such as PNG32 or JPG. Map tile layers are ideal when you want to display a large number of complex features efficently. For example, you may have high density elevation data that you want to be able to view seamlessly for an entire county.

To take advantage of the drawing performance of hosted map tiles, you can publish them from hosted feature layers or hosted feature layer views you own. Tiles published from hosted feature layers reflect the changes you make to the source feature data, and these tile layers automatically have popups enabled.

How to manage tile cache properties

The steps to manage map tile cache settings are:

  1. Log in to a data management tool with your ArcGIS account:

  2. Find the item.
  3. Use the item page to manage tile settings.

Types of management operations

You can use an item page or the ArcGIS REST API to perform map tile service management operations.

  • Service properties: The service properties contain the current settings of the map tile service. These include a reference to the source layer, the tiling schema and levels of detail.

  • Visible range: The visible range is the minimum and maximum scales at which the layer will draw.

  • Cache: The map tile cache can be set to generate tiles automatically or manually. When you configure a map tile service to create tiles automatically, ArcGIS Online creates tiles on demand as they are needed. Once enabled, tiles are cached and available for all subsequent views. When the source hosted feature layer or feature layer view is edited, changes are reflected in the hosted map tile layer within a couple minutes.

  • Offline mode: Allow the tiles to be downloaded and used in an offline map.

Code examples

You can use data management tools to manage the tile cache settings of a hosted map tile layer or you can use the ArcGIS REST APIs. The following examples illustrate how to programmatically get the cache properties, set the visible range, set automatic cache creation, build tiles and set the offline mode of a map tile service.

View service and cache settings

To access map tile service properties directly, use the REST API MapService endpoint to perform a GET request and pass the json and token parameters. A JSON structure will be returned containing the current properties of the service. This response contains properties such as layer details and tiling schema which you can reference when running management operations.

Request

Use dark colors for code blocksCopy
1
GET https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Point_Dume_Parcels_Tiled/MapServer?f=json&token={{access_token}} HTTP/1.1

Response

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
{
    "id": 13,
    "name": "Point_Dume_parcels",
    "server": "GVgbJbqm8hXASVYi",
    "ownerUserName": "esri_devlabs",
    "serviceDescription": "",
    "mapName": "Point_Dume_parcels",
    "description": "",
    "abstract": "",
    "metadataLink": "https://www.arcgis.com/sharing/rest/content/items/039369ca595648c6a82f42dbfe06a30a/info/metadata/metadata.xml?format=default",
    "keywords": [],
    "copyrightText": "",
    "layers": [
        {
            "id": 0,
            "name": "Point_Dume_parcels",
            "parentLayerId": -1,
            "defaultVisibility": true,
            "subLayerIds": null,
            "minScale": 72224,
            "maxScale": 1128,
            "type": "Feature Layer",
            "geometryType": "esriGeometryPolygon"
        }
    ],
    "tables": [],
Expand

Set the visible range

To manage the visible scale range programmatically, use the REST API edit admin operation passing in the new minScale, maxScale, serviceDefinition values. The sourceItemId parameter references the hosted feature layer item ID from which the map tile service was created.

Request

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
POST https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Point_Dume_Parcels_Tiled/MapServer/edit HTTP/1.1
f=json
&token={access_token}
&sourceItemId=0ade343c5e54499998c27a2ab743bb70
&minScale=25706
&maxScale=1128
&serviceDefinition={
    "minScale":"25706",
    "maxScale":"1128"
}

Response

Use dark colors for code blocksCopy
1
2
3
{
    "success":true
}

Set automatic cache creation

To enable automatic tile creation, use the REST API edit admin operation and set the cacheOnDemand property to true.

Request

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
POST https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Point_Dume_Parcels_Tiled/MapServer/edit HTTP/1.1
f=json
&token={{access_token}}
&sourceItemId=0ade343c5e54499998c27a2ab743bb70
&minScale=72224
&maxScale=2500
&serviceDefinition={{
    "minScale":"72224",
    "maxScale":"2500",
    "exportTilesAllowed":false
}}
&exportTilesAllowed=false
&cacheOnDemand=true

Response

Use dark colors for code blocksCopy
1
2
3
{
    "success":true
}

Build tiles

To build tiles manually, use the REST API updateTiles admin operation. The levels parameter specifies which tile levels you want to create and the extent parameter specifies the geographic extent the tiles to be built will cover. Use the returned jobId to check the job status.

Request

Use dark colors for code blocksCopy
1
2
3
4
5
POST https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/admin/services/Point_Dume_Parcels_Tiled/MapServer/updateTiles HTTP/1.1
f=json
&token={access_token}
levels=[13,14,15]
extent="-13229544.225200001,4028844.615199998,-13221610.4599,4033126.3599999994"

Response

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
    "id": "7428a221-da84-47d9-b3cb-2b4167b5a0bd",
    "name": "Point_Dume_parcels",
    "status": "Success",
    "itemId": "039369ca595648c6a82f42dbfe06a30a",
    "type": "Map Service",
    "jobId": "9383e05f-fd2e-4f20-b683-8747623b1780",
    "message": "success"
}

Set offline mode

Use the REST API edit admin operation with a POST request. The sourceItemId parameter is the item ID of the feature service the map tile service was created from. Set the exportTilesAllowed parameter to true to enable offline access or to false to disable offline access.

Request

Use dark colors for code blocksCopy
1
2
3
4
5
6
POST https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/admin/services/Point_Dume_Parcels_Tiled/MapServer/edit HTTP/1.1

f=json
&sourceItemId="{SourceFeatureLayerItemID}"
&exportTilesAllowed=true
&token="{access_token}"

Response

Use dark colors for code blocksCopy
1
2
3
{
    "success":true
}

Tutorials

Workflows

Services

API support

Use Client APIs to create, manage, and access data services. The table below outlines the level of support for each API.

CreateManageAccess
ArcGIS Maps SDK for JavaScript1
ArcGIS Maps SDK for Kotlin1
ArcGIS Maps SDK for Swift1
ArcGIS Maps SDK for Java1
ArcGIS Maps SDK for .NET1
ArcGIS Maps SDK for Qt1
ArcGIS API for Python
ArcGIS REST JS
Esri Leaflet2
MapLibre GL JS23
OpenLayers23
Full supportPartial supportNo support
  • 1. Use portal class and direct REST API requests
  • 2. Access via ArcGIS REST JS
  • 3. Requires manually setting styles for renderers

Tools

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