The cache and attributes settings for a hosted vector tile layer (item) can be used to set the cache and the attributes that are available for a vector tile service.
These settings allow you to:
- View the tile layers' current visible range.
- Enable tiles to be used in offline maps and applications.
- Rebuild the vector tile cache.
- Configure the attributes that are included in the cache.
What is a vector tile cache?
Vector tile services published to and hosted on ArcGIS portal support fast visualization of large datasets using a collection of pre-generated vector tiles. Vector tile layers are ideal when you need to view many features at once.
To take advantage of the drawing performance of hosted tiles, you can publish them from the hosted feature layers or hosted feature layer views you own. Tiles published from hosted features reflect the changes you make to the feature data.
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 cache settings.
Types of management operations
You can use an item page or the ArcGIS REST API to perform vector tile cache management operations. The most common operations include the following:
-
Service properties: Service properties contain the current settings of the vector tile service. These include a reference to the tile urls, the tiling schema, levels of detail and more.
-
Cache: The vector tile cache can be rebuilt. When edits occur in the source feature layer you need to rebuild the cache to include any changes from the source feature layer.
-
Feature attributes: Feature attributes can be included in the cache. Attributes included in the cache can be used in styling and for showing popups. Currently only supported in custom applications created using third-party software.
-
Offline mode: Allow the tiles to be downloaded and used in an offline map.
Code examples
You can use data management tools to manage tile cache of a vector tile service or you can use the ArcGIS REST APIs. The following examples illustrate how to programmatically get the properties, synchronize, set feature attributes, and set the offline mode of a vector tile service.
Get the service properties
To access all of the vector tile service properties directly, use the REST API VectorTileServer endpoint to perform a GET
request and pass the json
and token
parameters. A JSON
structure will be returned containing the current properties and values of the service.
Request
https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_Mountains_Parcels_Styled/VectorTileServer?f=json&token={{ACCESS_TOKEN}}?f=json&token={access_token} HTTP/1.1
Response
{
"currentVersion": 11.1,
"name": "Santa_Monica_Mountains_Parcels_Styled",
"capabilities": "TilesOnly,Tilemap",
"type": "indexedVector",
"serviceItemId": "31793f6c4c114ef684a8a0c6029ae2c0",
"publishJobId": "d015fc91-795f-42c9-9755-719dc6c28094",
"jobServiceId": "7506b667-c51f-4515-ac48-a7c0a66f6e73",
"ownerUserName": "",
"serviceDescription": "",
"description": "",
"isEnabled": true,
"id": 2241,
"sourceServiceName": "Santa_Monica_Mountains_Parcels_Styled",
"sourceServiceType": "FeatureServer",
"tileContainerName": "441d61e50db94e969ff3e0b61a36a637",
"creationDate": 1611725149467,
"datasource": "db",
"exportTilesAllowed": false,
"maxExportTilesCount": 100000,
"tileMap": "tilemap",
"defaultStyles": "resources/styles",
"tiles": [
"tile/{z}/{y}/{x}.pbf"
],
"exportTilesAllowed": false,
"initialExtent": {
"xmin": -13240863.776,
"ymin": 4023715.1402999982,
"xmax": -13173870.3567,
"ymax": 4054853.8936000015,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
},
"fullExtent": {
"xmin": -13240863.776,
"ymin": 4023715.1402999982,
"xmax": -13173870.3567,
"ymax": 4054853.8936000015,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
},
"minScale": 295828763.795777,
"maxScale": 35.2655367607897,
"maxZoom": 23,
"tileInfo": {
"rows": 512,
"cols": 512,
"dpi": 96,
"preciseDpi": 96,
"format": "indexedVector",
"origin": {
"x": -20037508.342787,
"y": 20037508.342787
},
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"lods": [
{
"level": 0,
"resolution": 78271.516963999937,
"scale": 295828763.795777
},
{
"level": 1,
"resolution": 39135.7584820001,
"scale": 147914381.897889
},
{
"level": 2,
"resolution": 19567.879240999919,
"scale": 73957190.948944
},
{
"level": 3,
"resolution": 9783.93962049996,
"scale": 36978595.474472
},
{
"level": 4,
"resolution": 4891.96981024998,
"scale": 18489297.737236
},
{
"level": 5,
"resolution": 2445.98490512499,
"scale": 9244648.868618
},
{
"level": 6,
"resolution": 1222.9924525624947,
"scale": 4622324.434309
},
{
"level": 7,
"resolution": 611.49622628137968,
"scale": 2311162.217155
},
{
"level": 8,
"resolution": 305.74811314055756,
"scale": 1155581.108577
},
{
"level": 9,
"resolution": 152.87405657041106,
"scale": 577790.554289
},
{
"level": 10,
"resolution": 76.437028285073225,
"scale": 288895.277144
},
{
"level": 11,
"resolution": 38.21851414253662,
"scale": 144447.638572
},
{
"level": 12,
"resolution": 19.10925707126831,
"scale": 72223.819286
},
{
"level": 13,
"resolution": 9.5546285356341567,
"scale": 36111.909643
},
{
"level": 14,
"resolution": 4.77731426794937,
"scale": 18055.954822
},
{
"level": 15,
"resolution": 2.3886571339746849,
"scale": 9027.977411
},
{
"level": 16,
"resolution": 1.1943285668550505,
"scale": 4513.988705
},
{
"level": 17,
"resolution": 0.59716428355981721,
"scale": 2256.994353
},
{
"level": 18,
"resolution": 0.29858214164761665,
"scale": 1128.497176
},
{
"level": 19,
"resolution": 0.14929107082380833,
"scale": 564.248588
},
{
"level": 20,
"resolution": 0.074645535411904163,
"scale": 282.124294
},
{
"level": 21,
"resolution": 0.037322767705952081,
"scale": 141.062147
},
{
"level": 22,
"resolution": 0.018661383852976041,
"scale": 70.5310735
},
{
"level": 23,
"resolution": 0.0093306919293428044,
"scale": 35.265536760789715
}
]
},
"resourceInfo": {
"styleVersion": 8,
"tileCompression": "gzip",
"cacheInfo": {
"storageInfo": {
"packetSize": 128,
"storageFormat": "compactV2"
}
}
}
}
Synchronize the cache
The rebuild
admin operation is used to start a job to rebuild the tile cache. A JSON
response will be returned containing the status of the job request. If the request returns a status of success
, you can use the job
returned to track the status of the job.
Request
POST https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/admin/services/Santa_Monica_Mountains_Parcels_Styled/VectorTileServer/rebuildCache HTTP/1.1
f=json
&token={access_token}
Response
{
"id": "7506b667-c51f-4515-ac48-a7c0a66f6e73",
"name": "Santa_Monica_Mountains_Parcels_Styled",
"status": "Success",
"itemId": "31793f6c4c114ef684a8a0c6029ae2c0",
"type": "Map Service",
"jobId": "d36c3a2b-7ec6-4736-8239-53d56b6a3664",
"message": "success"
}
Set feature attributes
To manage the attributes that are included in the cache, use the REST API edit admin operation. Pass in a JSON
object to the service
parameter, with an array of strings representing the field names you want to include. Attributes in vector tiles can currently only be used in custom applications.
Request
POST https://{VectorTileServiceHost}/{organizationId}/arcgis/rest/admin/services/{ServiceName}/VectorTileServer/edit HTTP/1.1
f=json
&token={access_token}
&serviceDefinition={
"layerProperties":[{
"id":0,
"additionalFields":["APN", "SitusAddre"]
}]
}
Response
{
"success": true
}
Set offline mode
To enable a vector tile service for offline use, use the REST API edit admin operation with a POST
request. The source
parameter is the Item ID of the feature service that the vector 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://{VectorTileServiceHost}/{organizationId}/arcgis/rest/admin/services/{ServiceName}/VectorTileServer/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