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.
What is a map tile cache?
Map tile services published to and hosted in ArcGIS portal 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 efficiently. 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:
-
Sign in to your portal:
- ArcGIS Location Platform: Go to https://location.arcgis.com > My portal.
- ArcGIS Online: Go to https://www.arcgis.com/home/signin.html.
- ArcGIS Enterprise: Go to your portal URL. Learn more at ArcGIS Enterprise > Use > Get started > Access.
- Find the item.
- 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
GET https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Point_Dume_Parcels_Tiled/MapServer?f=json&token={{access_token}} HTTP/1.1
Response
{
"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": [],
Set the visible range
To manage the visible scale range programmatically, use the REST API edit admin operation passing in the new min
, max
, service
values. The source
parameter references the hosted feature layer item ID from which the map tile service was created.
Request
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
{
"success":true
}
Set automatic cache creation
To enable automatic tile creation, use the REST API edit admin operation and set the cache
property to true
.
Request
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
{
"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 job
to check the job status.
Request
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
{
"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 source
parameter is the item ID of the feature service the map tile service was created from. Set the export
parameter to true
to enable offline access or to false
to disable offline access.
Request
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
{
"success":true
}
Tutorials
Import data to create a feature layer
Use data management tools to import files and create a feature layer in a feature service.
Define a new feature layer
Use data management tools to define and create a new empty feature layer in a feature service.
Manage a feature layer
Use a hosted feature layer item to set the properties and settings of a feature layer in a feature service.
Create a vector tile service
Use data management tools to create a new vector tile service from a feature service.
Create a map tile service
Use ArcGIS Online or scripting APIs to publish a map tile service.
Workflows
Create a feature service for an app
Learn how to import parcel data, create and style a feature layer, and then access the features in an app.
Create a feature layer view for an editor app
Learn how to import parcel data, create and style a feature layer view, and then access the features in an editing app.
Create a vector tile service for an app
Learn how to import parcel data, style a feature layer, and then create a vector tile service for an app.
Create a map tile service for an app
Learn how to import contour data, style a feature layer, and create a map tile service for an app.
Services
Feature service
Add, update, delete, and query feature data.
Vector tile service
Store and access vector tile data.
Map tile service
Store and access map tile data.
Image service
Store and access imagery and raster data.
API support
Use data management tools or Client APIs to create, manage, and access data services. The table below outlines the level of support for each API.
- 1. Use portal class and direct REST API requests
- 2. Access via ArcGIS REST JS
- 3. Requires manually setting styles for renderers