Download an offline map (on-demand)

Your app can use a web map while it has no internet connection, by first downloading an offline map from the web map. As soon as the offline map is downloaded, a mobile worker can disconnect their device and work with the map offline.

Mobile users can specify a geographic area of a web map to download as an offline map. Offline maps defined and created this way are known as on-demand offline maps. On-demand offline maps are useful for mobile users who don't necessarily know in advance where they will be working.

The main advantage of on-demand offline maps is that your app can specify parameters to ensure that only essential web map content is included in the offline map, such as:

  • The area of interest
  • The max and min scales
  • Which layers to include
  • Which features to include
  • Which related records to include
  • Whether to include attachments
  • Editing characteristics

The steps to use on-demand offline maps are:

  1. Create an offline map task
  2. Examine the web map's offline capabilities
  3. Create parameters to specify offline map content
  4. Create a job to generate and download an offline map
  5. Run the job

Create an offline map task

Create an OfflineMapTask from either an online Map or from a PortalItemrepresenting a web map.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Get a web map item from ArcGIS Online using its ID.
var agol = await ArcGISPortal.CreateAsync();
var webmapItem = await PortalItem.CreateAsync(agol, "acc027394bc84c2fb04d1ed317aac674");

// Create a map from the web map item.
var onlineMap = new Map(webmapItem);

// Create an OfflineMapTask from the map ...
takeMapOfflineTask = await OfflineMapTask.CreateAsync(onlineMap);
// ... or a web map portal item.
//takeMapOfflineTask = await OfflineMapTask.CreateAsync(webmapItem);

Examine the map's offline capabilities

You should check which layers and tables in the web map can be taken offline by examining the web map's offline capabilities. This can help identify layers or tables that are missing in the offline map that is generated.

Get the OfflineMapCapabilities object by calling the GetOfflineMapCapabilitiesAsync() method on OfflineMapTask.

When true, the hasErrors property indicates that one or more layers or tables cannot be taken offline due to an error. You can check the layerCapabilities and tableCapabilities to determine which layer or table cannot be taken offline, and why.

Some layers do not support being taken offline (either they have not been offline-enabled, or the type of layer does not support being taken offline). An offline map can still include references to these online-only layers, allowing the layers to be accessed and displayed whenever a network connection is available. This capability is set by OnlineOnlyServicesOption on GenerateOfflineMapParameters.

See Retain online services for more information.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
OfflineMapCapabilities results = await takeMapOfflineTask.GetOfflineMapCapabilitiesAsync(parameters);
if (results.HasErrors)
{
    foreach (var layerCapability in results.LayerCapabilities)
    {
        // Report layer errors ...
    }

    foreach (var tableCapability in results.TableCapabilities)
    {
        // Report table errors ...
    }
}

Create parameters to specify offline map content

When you generate and download an offline map, it should contain content relevant to the mobile user for the geographic area in which they will be working. Take care not to include more content than needed, because this can impact the time it takes to generate and download the offline map. Different parameters are available to control the geographic coverage area and the content of the generated offline map.

  1. Create the GenerateOfflineMapParameters by passing an area of interest to the CreateDefaultGenerateOfflineMapParametersAsync method on the OfflineMapTask.

  2. Get and examine the returned parameters. These default parameters represent the advanced offline settings configured by the web map author.

  3. To override default parameters see Advanced parameters. For example, you can automatically update and display online-only layers when a network connection is available (see Retain online services). You can also set the max and min scale, use a local basemap, or set a definition expression on features.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Create default parameters for the task.
Envelope areaOfInterest = GetAreaOfInterest();
var parameters = await takeMapOfflineTask.CreateDefaultGenerateOfflineMapParametersAsync(areaOfInterest);

// Limit the maximum scale to 5000 but take all the scales above (use default of 0 as the MinScale).
parameters.MaxScale = 5000;

// Set attachment options.
parameters.AttachmentSyncDirection = AttachmentSyncDirection.Upload;
parameters.ReturnLayerAttachmentOption = ReturnLayerAttachmentOption.EditableLayers;

// Update the map title to contain the region.
parameters.ItemInfo.Title = parameters.ItemInfo.Title + " (Central)";

Create a job to generate and download an offline map

To generate and download the offline map, you must create a GenerateOfflineMapJob by providing the GenerateOfflineMapParameters to the GenerateOfflineMap() method on OfflineMapTask. You must also provide a directory on the device to store the offline map. If this download directory already exists, it must be empty. If the directory doesn't exist, it will be created by the job.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Create the job to generate an offline map, pass in the parameters and a path to store the map package.
GenerateOfflineMapJob offlineMapJob = takeMapOfflineTask.GenerateOfflineMap(parameters, pathToOutputPackage);

If you want to control the individual layer and table content, you also need to provide the GenerateOfflineMapParameterOverrides as well as the GenerateOfflineMapParametersto the GenerateOfflineMap method on OfflineMapTask. For more details see Create offline map parameter overrides.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Create the job to generate an offline map, pass in the parameters, a path to store the map package, and overrides.
GenerateOfflineMapJob offlineMapJobWithOverrides = takeMapOfflineTask.GenerateOfflineMap
(parameters, pathToOutputPackage, offlineMapParamOverrides);

See the Tasks and jobs topic for more details on how to work with jobs in general.

Run the job

To generate the offline map and download it to your device, start the GenerateOfflineMapJob. When complete, the job returns a GenerateOfflineMapResult. If one or more tables or layers fails to be taken offline, the hasErrors property may be true (however a layer may be configured for "online-only", which is not an error). You can check the layerErrors and tableErrors dictionaries to identify problems.

If the ContinueOnErrors property of GenerateOfflineMapParameters is false, the job terminates if any layer or table fails to be taken offline.

If you want to display the map immediately, assign the GenerateOfflineMapResultOfflineMap to map property of the map view.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Generate the offline map and download it.
GenerateOfflineMapResult offlineMapResult = await _offlineMapJob.GetResultAsync();

if (!offlineMapResult.HasErrors)
{
    // Job completed successfully and all content was generated.
    Console.WriteLine("Map " + offlineMapResult.MobileMapPackage.Item.Title +
        " was saved to " + offlineMapResult.MobileMapPackage.Path);

    // Show the offline map in a MapView.
    MyMapView.Map = offlineMapResult.OfflineMap;
}
else
{
    // Job is finished but one or more layers or tables had errors.
    foreach (var layerError in offlineMapResult.LayerErrors)
    {
        // Report layer errors ...
    }
    foreach (var layerError in offlineMapResult.TableErrors)
    {
        // Report table errors ...
    }
}

Offline maps created by the on-demand workflow are stored in an unpacked mobile map package. When your app goes into the field, you need to open the map directly from this mobile map package downloadDirectory stored on your device.

Advanced parameters

You can set properties on GenerateOfflineMapParameters to control the offline map content. For example:

Scale range

A web map might include image tiled layers, which are composed of many tiles at different levels of detail (similar to a “zoom level”). The amount of space, generation time, and download time required to download tiled layers in a web map will increase with every level of detail. To increase performance, you should only download the levels of detail that are relevant for your app. You can control this by setting the minimum and maximum scale parameters MinScale and MaxScale.

If possible, choose a maximum scale that is not too “zoomed in” to prevent generating a large number of unnecessary tiles. Each service limits the number of tiles that can be taken offline. Make sure to set a scale range that avoids hitting this limit.

Include a map's basemap

A web map author can define whether offline maps should:

  • Download the basemap defined by the web map. This is the default and ensures that a tile package is downloaded with the map.

  • Use a tile package that is already on the device. The tile package must be downloaded or copied onto the device separately and can be referenced with an absolute file path or a path relative to the map. Make sure the tile package covers the areas required by your map area. The benefits of this option are that the map file will be smaller, the download time may be faster, and you can use the tile package in many different maps and apps.

    To use the tile package on your device, you must set the GenerateOfflineMapParameters referenceBasemapDirectory to the directory that contains the tile package. You should confirm that the tile package file, referenceBasemapFilename, exists on the device before running the GenerateOfflineMapJob. This job will add the tile package, as a basemap, to the offline map.

  • Avoid using the basemap. Developers can choose to override this configured behavior when they download an offline map from a web map. To do this, set the GenerateOfflineMapParameters's includeBasemap property to false. In this case the GenerateOfflineMapJob will not download any layers included as part of the map's Basemap. This task will not use the local tile package, even if you have specified one.

Retain online services

Live, online services are supported in offline maps. You can take a web map offline that has a mix of local on-device content as well as live, online service content (such as weather or traffic information). When network connectivity is available, users can use data from online services. Otherwise, only the local (offline) content is available.

A value of Include for GenerateOfflineMapParameters OnlineOnlyServicesOption means that any data that can't be taken offline will be accessed via the URL in the offline map. Your offline map retains all of the information from the original web map, but requires a network connection and may require authentication.

Manage synchronization of the map's geodatabases

Typically, the updateModeon the GenerateOfflineMapParameters is set to GenerateOfflineMapUpdateMode.SyncWithFeatureServices. This mode allows you to synchronize any geodatabase changes with their online feature services.

If you want to avoid receiving any geodatabase updates, set the updateMode on the GenerateOfflineMapParameters to noUpdates. This disables data synchronization on the map’s geodatabases and prevents the corresponding feature services from creating synchronization replicas. The benefits of this option are that the burden on the feature server is reduced and you will not need to unregister geodatabases when they are no longer required.

Apply feature layer definition expression filters

When taking a map offline, the GenerateOfflineMapJob applies the feature layer's definition expression by default. Applying the definition expression may reduce the number of features taken offline for display and sync. If you do not want to apply the definition expression, set IsDefinitionExpressionFilterEnabled to false.

If a map contains a layer or table with a relationship to another table, you can choose to download all rows or only related rows from the destination table. The default is to download only the related rows. If you want to return all rows, then you must set the value of DestinationTableRowFilter to be All.

If the table is a standalone table or the source of a relationship, all rows are returned.

Continue downloading the map if a single layer or table fails

By default, the GenerateOfflineMapJob continues to take layers and tables offline even if a layer or table fails. While this ensures that the map is taken offline, data may be missing. When the job completes, you should examine the job's result (discussed under Run the job) to identify if any layers have failed and determine whether or not to continue working with the map.

If you want the job to stop immediately when a layer or table fails, set the GenerateOfflineMapParameters's ContinueOnErrors property to false. This ensures that if a map is successfully taken offline it contains all of its layers and tables.

Failure to take a layer or table offline may be due to an intermittent network connection, loss of the service, or an unsupported layer type.

Inclusion of feature attachments

Some feature services contain attachments (pictures, videos, and other documents) for individual features. Because these files can be large, you should consider your app's offline workflow to determine whether the attachments need to be taken offline, and whether they need to be synchronized with the service when the app is connected. These two behaviors are defined using the returnLayerAttachmentOption and attachmentSyncDirection properties on the GenerateOfflineMapParameters class.

  • The return layer attachment property defines which layers should contain attachments in the offline map. The options are:

    • ReturnLayerAttachmentOption.None - None of the layers contain attachments.

    • ReturnLayerAttachmentOption.AllLayers - All layers have their attachments.

    • ReturnLayerAttachmentOption.ReadOnlyLayers - Layers without editing enabled have attachments.

    • ReturnLayerAttachmentOption.EditableLayers - Layers with editing enabled have attachments.

  • The attachment sync direction defines how the attachments are synchronized with the service. The options are:

    • AttachmentSyncDirection.None - Attachments are not synchronized as part of the synchronization operation.

    • AttachmentSyncDirection.Upload - Attachments are uploaded from the client to the service, but any changes on the service are not downloaded to the client.

    • AttachmentSyncDirection.Bidirectional - Attachments are uploaded from client to the service, and changes on the service are pulled down to the client.

Inclusion of features from editable feature layers

Here are some workflows that describe how these two parameters affect each other:

  • Workflow 1 — Download attachments for all layers in the map, allow the user to add or remove attachments from the layers, and then synchronize these changes between the service and the client when online. For example: multiple users collect data on the same area and they want to synchronize all the changes with the centralized services as well as sharing changes with other people in the field.

    • ReturnLayerAttachmentOption.AllLayers
    • AttachmentSyncDirection.Bidirectional
  • Workflow 2 — Download attachments for all read-only layers and update these layers when online. For example: users are offline and viewing a layer of buildings with photos that show how the buildings look. If there are any new photos added to the service, these will be downloaded to the client during synchronization when online.

    • ReturnLayerAttachmentOption.ReadOnlyLayers
    • AttachmentSyncDirection.Bidirectional
  • Workflow 3 — Download attachments for editable layers only and upload them to the service when online. For example: users are offline and only need to view attachments for editable layers. If there are any read-only layers that provide context for the map, their attachments aren’t included to the local map. If users remove or add any new attachments, these changes can be synchronized to the service when online.

    • ReturnLayerAttachmentOption.EditableLayers
    • AttachmentSyncDirection.Bidirectional
  • Workflow 4 — Do not download any attachments but allow any new attachments to be uploaded to the service when online. For example: users are offline and collecting new attachments in the field but do not need to view existing attachments.

    • ReturnLayerAttachmentOption.None
    • AttachmentSyncDirection.Upload

If users are collecting new information in the field where they do not need to access previously created features, you can create an offline map with empty editable feature layers. Do this by setting the GenerateOfflineMapParameters's ReturnSchemaOnlyForEditableLayers property to true.

Update or replace map's metadata

Access an online map's metadata from the itemInfo property. It includes portal item properties such as the title, description, short description, and thumbnail. This information is populated from the portal item that contains the map. You can override any of these metadata properties before you take the map offline. For example, if you are creating offline maps of different areas of interest on the same map, you may want to change the map's title to indicate which area it contains.

You can also create a new OfflineMapItemInfo object and manually set all the details.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Create a new OfflineMapItemInfo to store metadata for the map.
OfflineMapItemInfo itemInfo = new OfflineMapItemInfo();

// Create new thumbnail from the map
RuntimeImage thumbnailImage = await MyMapView.ExportImageAsync();

// Provide a better title and thumbnail to describe the map extent.
itemInfo.Thumbnail = thumbnailImage;
itemInfo.Title = "Water network (Central)";

// Copy basic info from the source item.
itemInfo.Snippet = webMapItem.Snippet;
itemInfo.Description = webMapItem.Description;
itemInfo.AccessInformation = webMapItem.AccessInformation;

// Add some tags.
itemInfo.Tags.Add("Water network");
itemInfo.Tags.Add("Data validation");

// Apply the metadata to the offline map parameters.
parameters.ItemInfo = itemInfo;

Create offline map parameter overrides

You may want to control how individual layers or tables are taken offline to do things like:

  • Reduce the amount of data (for example, tile data) for a given layer
  • Alter the spatial extent of a given layer (for example, to give coverage beyond the study area)
  • Filter features (for example, with a where clause) to only take those that are relevant to your fieldwork
  • Take features with null geometry (for example, where the attributes are populated in the office but the geometry needs to be captured on-site)
  • Omit individual layers
  • Define which layers should reference online content

The GenerateOfflineMapParameterOverrides object provides control for these behaviors. It includes three dictionaries containing the generate geodatabase parameters (for feature layers), export vector tile parameters (for vector tile layers), and export tile cache parameters (for image tile layers), as well as two lists of layers and tables that will retain online access in the offline map (see Retain online services). Adjust any of these parameters and create the GenerateOfflineMapJob using the overrides object.

To control how individual layers and tables are taken offline, follow these steps:

  1. Generate and modify the GenerateOfflineMapParameters as described in Create parameters to specify offline map content above.

  2. Generate the parameter overrides object (GenerateOfflineMapParameterOverrides) using the CreateGenerateOfflineMapParameterOverridesAsync() method on the OfflineMapTask. Provide the GenerateOfflineMapParameters generated from the previous step.

  3. When the task completes, a pre-populated GenerateOfflineMapParameterOverrides object will be provided. This is a modifiable layer-by-layer representation of the supplied GenerateOfflineMapParameters and includes three dictionaries containing detailed parameters for each layer and table:

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Get the offline map parameter overrides from the map task (pass in the task parameters).
GenerateOfflineMapParameterOverrides offlineMapParamOverrides =
await takeMapOfflineTask.CreateGenerateOfflineMapParameterOverridesAsync(parameters);

// Get the dictionary of parameter overrides for exporting a tile cache.
IDictionary<OfflineMapParametersKey, ExportTileCacheParameters> tileCacheParamOverrides =
offlineMapParamOverrides.ExportTileCacheParameters;
// Get the dictionary of parameter overrides for exporting vector tiles.
IDictionary<OfflineMapParametersKey, ExportVectorTilesParameters> vectorTileParamOverrides =
offlineMapParamOverrides.ExportVectorTilesParameters;
// Get the dictionary of parameter overrides for generating a geodatabase.
IDictionary<OfflineMapParametersKey, GenerateGeodatabaseParameters> geodatabaseParamOverrides =
offlineMapParamOverrides.GenerateGeodatabaseParameters;
// TODO: Override parameter values as needed.

To override specific parameters for a layer, create an OfflineMapParametersKey for the layer and use it to access the pre-populated parameters for that layer in the appropriate dictionary of the GenerateOfflineMapParameterOverrides. You can then modify individual properties for taking that layer offline.

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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
// Create a dictionary key for the desired parameter override.
OfflineMapParametersKey streetsParameterKey = new OfflineMapParametersKey(streetsLayer);

// Get one generate geodatabase parameter overrides.
GenerateGeodatabaseParameters streetsGdbParams = geodatabaseParamOverrides[streetsParameterKey];

// Don't return attachments for this layer.
streetsGdbParams.ReturnAttachments = false;

The GenerateOfflineMapParameterOverrides also includes two lists which can be modified to specify which Layer and ServiceFeatureTable objects should not have content downloaded but should instead access the original online data whenever a network connection is available (see Retain online services for more details).

After defining your overrides, you can create a GenerateOfflineMapJob by calling GenerateOfflineMap on the offline map task, supplying the parameters and the overrides.

Considerations

  • Advanced symbols are supported only if they are defined in the original service. Any overrides with advanced symbols will result in empty symbols in an offline map.

  • Area-of-interest geometries that cross the dateline are not currently supported.

  • If more than one feature layer in a map refers to the same feature service endpoint, only one feature layer will be taken offline. The other feature layers will raise an error.

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