Click or drag to resize

TileCache Class

A local on-disk cache of pre-rendered map tiles that can be used to create a layer.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.MappingTileCache

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public sealed class TileCache : ILoadable

The TileCache type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleTileCache
Initializes a new instance of the TileCache class.
Top
Properties
  NameDescription
Public propertyAntialiasing
Gets a value indicating whether this cache uses antialiasing.
Public propertyCacheStorageFormat
Gets the storage format of this tile cache.
Public propertyFullExtent
Gets the full extent of the tile cache.
Public propertyLoadError
Gets the load error for this instance - if any.
Public propertyLoadStatus
Gets the load status of the instance.
Public propertyPath
Gets the path of the tile cache.
Public propertyThumbnail
Gets the thumbnail image of this tile cache.
Public propertyThumbnailData Obsolete.
Gets the thumbnail image of this tile cache.
Public propertyTileInfo
Gets the tile scheme information used by this tile cache.
Top
Methods
  NameDescription
Public methodCancelLoad
Cancels an ongoing load.
Public methodClone
Clones this instance of the tile cache and its members.
Public methodGetTileData
Returns the tile data for the specified tile key.
Public methodCode exampleLoadAsync
Initiates loading of metadata for this instance
Public methodRetryLoadAsync
Retry loading metadata for the instance.
Top
Events
  NameDescription
Public eventLoaded
Occurs when this instance is loaded.
Public eventLoadStatusChanged
Occurs when the instance's LoadStatus has changed.
Top
Remarks

A tile cache stores a collection of images at various scales. A client can request the tiles needed to display a particular map extent. You can use ExportTileCacheJob to generate and download tiles from a service, creating a tile package (.tpk/.tpkx). Alternatively, you can use ArcGIS Pro to create a map tile package and provision it to the device.

Functional characteristics

ArcGIS tiled layers do not support reprojection, query, select, identify, or editing.

Performance characteristics

Tiles are generated when the cache is created. Requests for tiles are made on multiple threads and handled asynchronously. The size of each returned tile increases as the resolution or complexity of the image in the tile increases. For example, high-resolution imagery tiles can be larger files than topographic mapping for the same area and map extent.

Local tile caches are ideal for providing basemaps or less frequently changing contextual layers, where network access is limited or non-existent. They can be created and downloaded onto a device by using an ExportTileCacheJob, or alternatively can be provisioned directly to local storage.

The supported types of cache are:

  • Tile package (.tpk or .tpkx) - a map and the tile cache of the data contained within it, packaged into one convenient, portable file, ideal for offline sharing or complete map documents in a disconnected environment or via a portal.
  • Compact Cache - a directory structure where groups of tiles are combined into larger .bundle files, preserving performance and reducing copy times and the size on disk of the cache.
  • Exploded Cache - a directory structure where map tiles are stored as individual files. A TileCache is often used as a basemap, but can also be used to create an ArcGISTiledLayer that is added to a map as an operational layer.

A tile cache is often used as a basemap, but can also be used to create an ArcGISTiledLayer that is added to a map as an operational layer.

Examples

UWP

Example Name: CreateTerrainSurfaceTilePackage

Set the terrain surface with elevation described by a local tile package.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Mapping;

namespace ArcGISRuntime.UWP.Samples.CreateTerrainSurfaceTilePackage
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Create terrain from local tile package",
        category: "Scene",
        description: "Set the terrain surface with elevation described by a local tile package.",
        instructions: "When loaded, the sample will show a scene with a terrain surface applied. Pan and zoom to explore the scene and observe how the terrain surface allows visualizing elevation differences.",
        tags: new[] { "3D", "LERC", "elevation", "surface", "terrain", "tile cache" })]
    [ArcGISRuntime.Samples.Shared.Attributes.OfflineData("cce37043eb0440c7a5c109cf8aad5500")]
    public partial class CreateTerrainSurfaceTilePackage
    {
        public CreateTerrainSurfaceTilePackage()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Create the scene.
            MySceneView.Scene = new Scene(BasemapStyle.ArcGISImageryStandard);

            // Get the path to the elevation tile package.
            string packagePath = DataManager.GetDataFolder("cce37043eb0440c7a5c109cf8aad5500", "MontereyElevation.tpk");

            // Create the elevation source from the tile cache.
            TileCache elevationCache = new TileCache(packagePath);
            ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(elevationCache);

            // Create a surface to display the elevation source.
            Surface elevationSurface = new Surface();

            // Add the elevation source to the surface.
            elevationSurface.ElevationSources.Add(elevationSource);

            // Add the surface to the scene.
            MySceneView.Scene.BaseSurface = elevationSurface;

            // Set an initial camera viewpoint.
            Camera camera = new Camera(36.525, -121.80, 300.0, 180, 80.0, 0.0);
            MySceneView.SetViewpointCamera(camera);
        }
    }
}
XAML
<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.CreateTerrainSurfaceTilePackage.CreateTerrainSurfaceTilePackage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:SceneView x:Name="MySceneView" />
    </Grid>
</UserControl>
Examples

Xamarin Forms UWP

Example Name: CreateTerrainSurfaceTilePackage

Set the terrain surface with elevation described by a local tile package.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Mapping;
using Xamarin.Forms;

namespace ArcGISRuntimeXamarin.Samples.CreateTerrainSurfaceTilePackage
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Create terrain from local tile package",
        category: "Scene",
        description: "Set the terrain surface with elevation described by a local tile package.",
        instructions: "When loaded, the sample will show a scene with a terrain surface applied. Pan and zoom to explore the scene and observe how the terrain surface allows visualizing elevation differences.",
        tags: new[] { "3D", "LERC", "elevation", "surface", "terrain", "tile cache" })]
    [ArcGISRuntime.Samples.Shared.Attributes.OfflineData("cce37043eb0440c7a5c109cf8aad5500")]
    public partial class CreateTerrainSurfaceTilePackage : ContentPage
    {
        public CreateTerrainSurfaceTilePackage()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Create the scene.
            MySceneView.Scene = new Scene(BasemapStyle.ArcGISImageryStandard);

            // Get the path to the elevation tile package.
            string packagePath = DataManager.GetDataFolder("cce37043eb0440c7a5c109cf8aad5500", "MontereyElevation.tpk");

            // Create the elevation source from the tile cache.
            TileCache elevationCache = new TileCache(packagePath);
            ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(elevationCache);

            // Create a surface to display the elevation source.
            Surface elevationSurface = new Surface();

            // Add the elevation source to the surface.
            elevationSurface.ElevationSources.Add(elevationSource);

            // Add the surface to the scene.
            MySceneView.Scene.BaseSurface = elevationSurface;

            // Set an initial camera viewpoint.
            Camera camera = new Camera(36.525, -121.80, 300.0, 180, 80.0, 0.0);
            MySceneView.SetViewpointCamera(camera);
        }
    }
}
XAML
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             x:Class="ArcGISRuntimeXamarin.Samples.CreateTerrainSurfaceTilePackage.CreateTerrainSurfaceTilePackage">
    <Grid>
        <esriUI:SceneView x:Name="MySceneView" />
    </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
CreateTerrainSurfaceTilePackageSet the terrain surface with elevation described by a local tile package.
EditAndSyncFeaturesSynchronize offline edits with a feature service.
ExportTilesDownload tiles to a local tile cache file stored on the device.
GenerateGeodatabaseGenerate a local geodatabase from an online feature service.
OfflineGeocodeGeocode addresses to locations and reverse geocode locations to addresses offline.
OfflineRoutingSolve a route on-the-fly using offline data.