Export vector tiles

View inFormsWPFWinUIView on GitHub

Export tiles from an online vector tile service.

Export vector tiles

Use case

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

How to use the sample

When the vector tiled layer loads, zoom in to the extent you want to export. The red box shows the extent that will be exported. Tap the "Export vector tiles" button to start exporting the vector tiles. An error will show if the extent is larger than the maximum limit allowed. When finished, a new map view will show the exported result.

How it works

  1. Create an ArcGISVectorTiledLayer, from the map's base layers.
  2. Create an ExportVectorTilesTask using the vector tiled layer's URL.
  3. Create default ExportVectorTilesParameters from the task, specifying extent and maximum scale.
  4. Create an ExportVectorTilesJob from the task using the parameters, specifying a vector tile cache path, and an item resource path. The resource path is required if you want to export the tiles with the style.
  5. Start the job, and once it completes successfully, get the resulting ExportVectorTilesResult.
  6. Get the VectorTileCache and ItemResourceCache from the result to create an ArcGISVectorTiledLayer that can be displayed to the map view.

Relevant API

  • ArcGISVectorTiledLayer
  • ExportVectorTilesJob
  • ExportVectorTilesParameters
  • ExportVectorTilesResult
  • ExportVectorTilesTask
  • ItemResourceCache
  • VectorTileCache

Additional information

Vector tiles have high drawing performance and smaller file size compared to regular tiled layers, due to consisting solely of points, lines, and polygons. However, in ArcGIS Runtime SDK they cannot be displayed in scenes. Visit ArcGIS for Developers to learn more about the characteristics of ArcGIS vector tiled layers.

Tags

cache, download, offline, vector

Sample Code

ExportVectorTiles.xamlExportVectorTiles.xamlExportVectorTiles.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
45
46
47
48
49
50
51
52
53
<UserControl x:Class="ArcGISRuntime.WinUI.Samples.ExportVectorTiles.ExportVectorTiles"
             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:MapView x:Name="MyMapView" ViewpointChanged="MyMapView_ViewpointChanged" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <Button x:Name="MyExportButton"
                        Width="330"
                        HorizontalAlignment="Center"
                        Click="MyExportButton_Click"
                        Content="Export vector tiles"
                        IsEnabled="False" />
                <Grid>
                    <ProgressBar x:Name="MyProgressBar"
                                 Width="330"
                                 MinHeight="20"
                                 Margin="0,10,0,0"
                                 HorizontalAlignment="Center"
                                 Background="Transparent"
                                 Maximum="100"
                                 Minimum="0"
                                 Visibility="Collapsed" />
                    <TextBlock x:Name="MyProgressBarLabel"
                               Margin="0,10,0,0"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Visibility="Collapsed" />
                </Grid>

                <esriUI:MapView x:Name="MyPreviewMapView"
                                Width="330"
                                Height="280"
                                Visibility="Collapsed" />
                <Button x:Name="MyCancelJobButton"
                        Width="330"
                        Margin="0,10,0,0"
                        HorizontalAlignment="Center"
                        Click="MyCancelJobButton_Click"
                        Content="Cancel"
                        Visibility="Collapsed" />
                <Button x:Name="MyClosePreviewButton"
                        Width="330"
                        Margin="0,10,0,0"
                        HorizontalAlignment="Center"
                        Click="MyClosePreviewButton_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.