Offline maps

Offline maps

What is an offline map?

An offline map is a map downloaded from a web map. It also includes data content that is referenced by layers in the offline map. You can use an offline map in your partially offline app to edit features, non-spatial data, related records, and attachments without a network connection. You keep an offline map's data content current with the content of the source web map's layers by synchronizing the offline map and the web map. A network connection is required to synchronize.

You use offline maps to create offline apps that:

  • Provide detailed, editable, interactive maps to large mobile workforces.
  • View, collect and edit data in remote areas where network connectivity is unpredictable or unavailable.
  • Support disaster recovery operations when infrastructure has been damaged.
  • Keep map data up to date with the latest edits from mobile workers.
  • Keep mobile workers updated with the latest data and maps.

How to work with offline maps

The general workflow to work with an offline map in an offline application is:

1. Create

To begin working with an offline map, create a web map and enable it for offline use. To create a new web map, you can use Map Viewer or ArcGIS Pro. These tools allow you to design and configure a map interactively and then save it in a portal.

Once your web map is saved, go to the item page of the web map in ArcGIS Online to enable it for offline use. Make sure that all the layers included in the web map are also offline-enabled. Layers that reference the following services can have their data content included in the offline map:

  • The basemap styles service (including default basemap styles and custom basemap styles created using the Vector Tile Style Editor).
  • A feature service that has been offline enabled. This includes features, non-spatial data, related records, and attachments.
  • A vector tile service that has been offline enabled.
  • A map tile service that has been offline enabled.

Other layers can be included in an offline map but continue to reference the online data source. These layers can be used whenever the offline app has a network connection. In addition to data layers, an offline map can include tables of non-spatial data. A non-spatial table typically contains rows of data related to features in the source web map's data layers.

2. Manage

After configuring a web map and enabling it for offline use, there are two ways to manage and define map areas inside the web map to take offline.

Define the map areas ahead-of-time

In this method, the owner of the web map must first define geographic areas of the web map to be packaged as offline maps. These geographic areas are known as offline map areas or preplanned map areas, since they are planned and defined beforehand. If you choose this method, you will have to define your offline map areas in the web map's item page in the portal using the Manage offline map areas button. A web map can have up to 16 offline map areas defined. You can also configure settings such as packaging schedule of your offline map area and level of detail for the downloaded raster or vector tile layer. Offline map areas remain available for download until the owner of the web map removes the offline map area from the web map. They can also be downloaded multiple times by different offline applications.

Offline map areas are quick to download and ready to be used because they are generated before they are needed. They are hosted alongside the web map, ready for download, so the user experience is similar to downloading any other file or resource. These maps also support updating packages, which can be useful for applications that cover large areas, are updated frequently, or support many mobile workers.

Define the map areas on-demand

In this method, the user of the offline app requests for an area of the web map to be packaged as an offline map. Then, the ArcGIS Maps SDK for Native Apps generates the specified area and downloads it. This process happens on demand, hence the name. If you choose this method, you will define an area in your application code (generally using the Polygon class from ArcGIS Maps SDKs for Native Apps) that represents an area within the web map you want to download as an offline map. The offline map can only be downloaded once by the offline application that requested it. It is not hosted for later download. If another offline application needs to download the same map area, it must make a new request.

While this method gives the app users more flexibility to choose their own desired map area to download, each offline map must be generated at the time it is requested. This introduces a delay before the offline map can be downloaded, which impacts the offline application's user experience. To mitigate this delay, there are ways you can optimize downloading your on-demand offline maps.

3. Access

After you create an offline-enabled web map and manage the offline map, you can download and display the offline map with an offline app built with ArcGIS Maps SDKs for Native Apps. The code will differ based on whether you use the ahead-of-time or on-demand method to download the offline map.

There are two steps to access an offline map:

  1. When you download and display it for the first time. This requires a network connection.
    ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt
    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
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
            private async Task GetOfflinePreplannedMap()
            {
                var portal = await ArcGISPortal.CreateAsync();
                var portalItem = await PortalItem.CreateAsync(portal, "YOUR_ITEM_ID"); // Replace with your web map ID
                var map = new Map(portalItem);
    
                OfflineMapTask offlineMapTask = await OfflineMapTask.CreateAsync(map);
                IReadOnlyList<PreplannedMapArea> availableAreas = await offlineMapTask.GetPreplannedMapAreasAsync();
    
                if (availableAreas?.FirstOrDefault() is PreplannedMapArea area)
                {
                    DownloadPreplannedOfflineMapParameters downloadParameters = await offlineMapTask.CreateDefaultDownloadPreplannedOfflineMapParametersAsync(area);
    
                    string documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    _downloadLocation = System.IO.Path.Combine(documentsFolder, "OfflineMap");
    
                    DownloadPreplannedOfflineMapJob job = offlineMapTask.DownloadPreplannedOfflineMap(downloadParameters, _downloadLocation);
                    DownloadPreplannedOfflineMapResult result = await job.GetResultAsync();
    
                    if (result?.OfflineMap is Map offlineMap)
                    {
                        this.Map = offlineMap;
                    }
                }
            }
    
  2. When you display a previously downloaded offline map from your local storage. This does not require a network connection.
    ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt
    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
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
                var mobileMapPackage = await MobileMapPackage.OpenAsync(_downloadLocation);
    
                await mobileMapPackage.LoadAsync();
    
                this.Map = mobileMapPackage.Maps.First();
    

When your offline application no longer needs an offline map, it is recommended that you unregister any feature data contained in the offline map. However, you do not need to unregister if the offline map is read-only. This process is also known as geodatabase unregistration.

Code examples

Display an offline map (ahead of time)

Create an offline-enabled web map

  1. Sign in to your portal and click Map.
  2. In the left panel, click + > Browse layers > ArcGIS Online.
    • In the search box, type World Street Map (for Developers).
    • Click on the resulting Tile Layer from Esri Vector Maps, then click Use as basemap.
  3. Move the map and zoom to Santa Monica, California. The web map should look like Santa Monica Web Map.
  4. In Map Viewer, Save the web map.
  5. Share the web map with your desired audience.

Manage offline map

  1. In the web map's item page, go to Settings > Offline.
  2. Toggle on the Enable offline mode switch.
  3. Click Manage Offline Areas.
  4. Click + Create offline area.
  5. Using the Sketch tool, draw a region of the web map to take offline.
  6. Click Save and wait for the offline map to be generated.

Access offline map

  1. Find the web map item ID or use 8ab76e9c5352400d87ca3315db9ba08e.
  2. Create an OfflineMapTask referencing the web map item ID.
  3. Request a list of available offline maps and select one of the offline maps to download.
  4. Create a DownloadPreplannedOfflineMapJob.
  5. Start the job and wait for it to complete.
  6. Set the MapView's map to the offline map.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
        private async Task GetOfflinePreplannedMap()
        {
            var portal = await ArcGISPortal.CreateAsync();
            var portalItem = await PortalItem.CreateAsync(portal, "YOUR_ITEM_ID"); // Replace with your web map ID
            var map = new Map(portalItem);

            OfflineMapTask offlineMapTask = await OfflineMapTask.CreateAsync(map);
            IReadOnlyList<PreplannedMapArea> availableAreas = await offlineMapTask.GetPreplannedMapAreasAsync();

            if (availableAreas?.FirstOrDefault() is PreplannedMapArea area)
            {
                DownloadPreplannedOfflineMapParameters downloadParameters = await offlineMapTask.CreateDefaultDownloadPreplannedOfflineMapParametersAsync(area);

                string documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                _downloadLocation = System.IO.Path.Combine(documentsFolder, "OfflineMap");

                DownloadPreplannedOfflineMapJob job = offlineMapTask.DownloadPreplannedOfflineMap(downloadParameters, _downloadLocation);
                DownloadPreplannedOfflineMapResult result = await job.GetResultAsync();

                if (result?.OfflineMap is Map offlineMap)
                {
                    this.Map = offlineMap;
                }
            }
        }

Display an offline map (on-demand)

Create an offline-enabled web map

  1. Sign in to your portal and click Map.
  2. In the left panel, click + > Browse layers > ArcGIS Online.
    • In the search box, type World Street Map (for Developers).
    • Click on the resulting Tile Layer from Esri Vector Maps, then click Use as basemap.
  3. Move the map and zoom to Santa Monica, California. The web map should look like Santa Monica Web Map.
  4. In Map Viewer, Save the web map.
  5. Share the web map with your desired audience.

Manage offline map

  1. In the web map's item page, go to Settings > Offline.
  2. Toggle on the Enable offline mode switch.

Access offline map

  1. Find the web map item ID or use 8ab76e9c5352400d87ca3315db9ba08e.
  2. Create an OfflineMapTask referencing the web map item ID.
  3. Specify a geographic area to download.
  4. Create a GenerateOfflineMapJob.
  5. Start the job and wait for it to complete.
  6. Set the MapViewModel's map to the offline map.
ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
        private async Task SetupMap()
        {
            // Create a portal pointing to ArcGIS Online.
            ArcGISPortal portal = await ArcGISPortal.CreateAsync();

            // Create a portal item for a specific web map id.
            string webMapId = "YOUR_ITEM_ID"; // Replace with your web map ID
            PortalItem mapItem = await PortalItem.CreateAsync(portal, webMapId);

            // Create the map from the item.
            Map map = new Map(mapItem);

            // Set the view model "Map" property.
            this.Map = map;

            // Define area of interest (envelope) to take offline.
            EnvelopeBuilder envelopeBldr = new EnvelopeBuilder(SpatialReferences.Wgs84)
            {
                XMin = -118.5064,
                XMax = -118.4800,
                YMin = 34.0094,
                YMax = 34.0259
            };

            Envelope offlineArea = envelopeBldr.ToGeometry();

            // Create an offline map task using the current map.
            OfflineMapTask offlineMapTask = await OfflineMapTask.CreateAsync(map);

            // Create a default set of parameters for generating the offline map from the area of interest.
            GenerateOfflineMapParameters parameters = await offlineMapTask.CreateDefaultGenerateOfflineMapParametersAsync(offlineArea);
            parameters.UpdateMode = GenerateOfflineMapUpdateMode.NoUpdates;

            // Build a folder path named with today's date/time in the "My Documents" folder.
            string documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string downloadDirectory = System.IO.Path.Combine(documentsFolder, "OfflineMap_" + DateTime.Now.ToFileTime().ToString());

            GenerateOfflineMapJob generateJob = offlineMapTask.GenerateOfflineMap(parameters, downloadDirectory);

            generateJob.ProgressChanged += GenerateJob_ProgressChanged;

            generateJob.Start();

        }

        private async void GenerateJob_ProgressChanged(object? sender, EventArgs e)
        {

            try
            {
                var generateJob = sender as GenerateOfflineMapJob;
                if(generateJob == null) { return; }

                // If the job succeeds, show the offline map in the map view.
                if (generateJob.Status == Esri.ArcGISRuntime.Tasks.JobStatus.Succeeded)
                {
                    var result = await generateJob.GetResultAsync();
                    this.Map = result.OfflineMap;
                    Debug.WriteLine("Generate offline map: Complete");
                }
                // If the job fails, notify the user.
                else if (generateJob.Status == Esri.ArcGISRuntime.Tasks.JobStatus.Failed)
                {
                    MessageBox.Show($"Unable to generate a map for that area: {generateJob?.Error?.Message}");
                }
                else
                {
                    int percentComplete = generateJob.Progress;
                    Debug.WriteLine($"Generate offline map: {percentComplete}%");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error generating offline map: {ex.Message}");
            }

        }

Tutorials

Create an offline-enabled web map

Use Map Viewer and the ArcGIS portal to create an offline-enabled web map.


Create an offline map area

Use your portal to create an offline map area from an offline-enabled web map.


Create a mobile map package

Use ArcGIS Pro to create a mobile map package.


Workflows

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