Export tiles

View inAndroidFormsUWPWPFWinUIiOSView on GitHubSample viewer app

Download tiles to a local tile cache file stored on the device.

Image of export tiles

Use case

Field workers with limited network connectivity can use exported tiles as a basemap for use offline.

How to use the sample

Pan and zoom into the desired area, making sure the area is within the red boundary. Click the 'Export tiles' button to start the process. On successful completion you will see a preview of the downloaded tile package.

How it works

  1. Create a map and set its MinScale to 10,000,000. Limiting the scale in this sample limits the potential size of the selection area, thereby keeping the exported tile package to a reasonable size.
  2. Create an ExportTileCacheTask, passing in the URI of the tiled layer.
  3. Create default ExportTileCacheParameters for the task, specifying extent, minimum scale and maximum scale.
  4. Use the parameters and a path to create an ExportTileCacheJob from the task.
  5. Start the job, and when it completes successfully, get the resulting TileCache.
  6. Use the tile cache to create an ArcGISTiledLayer, and display it in the map.

Relevant API

  • ArcGISTiledLayer
  • ExportTileCacheJob
  • ExportTileCacheParameters
  • ExportTileCacheTask
  • TileCache

Additional information

ArcGIS tiled layers do not support reprojection, query, select, identify, or editing. See the Layer types discussion in the developers guide to learn more about the characteristics of ArcGIS tiled layers.

Tags

cache, download, export, local, offline, package, tiles

Sample Code

ExportTiles.xamlExportTiles.xamlExportTiles.xaml.cs
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
<UserControl x:Class="ArcGISRuntime.WPF.Samples.ExportTiles.ExportTiles"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <Button x:Name="MyExportButton"
                        Click="MyExportButton_Click"
                        Content="Export Tiles"
                        IsEnabled="False" />
                <Grid>
                    <ProgressBar x:Name="MyProgressBar"
                                 MinHeight="10"
                                 Margin="0,10,0,0"
                                 Maximum="100"
                                 Minimum="0"
                                 Visibility="Collapsed" />
                    <TextBlock x:Name="MyProgressBarLabel"
                               Margin="0,10,0,0"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Text="{Binding ElementName=MyProgressBar, Path=Value, StringFormat={}{0:0}%}"
                               Visibility="Collapsed" />
                </Grid>
                <esri:MapView x:Name="MyPreviewMapView"
                              Width="375"
                              Height="280"
                              Visibility="Collapsed" />
                <Button x:Name="MyCancelJobButton"
                        Margin="0,10,0,0"
                        Click="CancelJobButton_Click"
                        Content="Cancel"
                        Visibility="Collapsed" />
                <Button x:Name="MyClosePreviewButton"
                        Margin="0,10,0,0"
                        Click="ClosePreview_Click"
                        Content="Close Preview"
                        Visibility="Collapsed" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

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