Work with data files

Just as layers in your app can use data sourced from online services, such as ArcGIS Online, WFS, or WMS services, layers can also use data from data files stored locally on your user's device. Local data files support scenarios where your users never have a network connection.

This page describes what you can do with data files and lists supported data file formats. It also provides details on how to use a data file in your app, which are summarized in the following steps:

  1. Create, sideload, or download the data file onto your user's device.
  2. Access the data file with ArcGIS Runtime.
  3. Create a layer referencing the data file.
  4. Apply a renderer to define symbols for features in the layer (Optional).
  5. Add the layer to a map or scene.

For information on mobile map packages and mobile scene packages, which are also stand-alone files, see Offline maps, scenes, and data or the ArcGIS Pro topics Share a mobile map package and Share a mobile scene package. For details on working with data from services while offline, see Work with offline data.

What you can do with data files

You can do the following types of things in your app using local data files:

  • Display maps or scenes without a network connection.
  • Access, display, and analyze geospatial data.
  • Include data with the installation of your app.
  • Collect data on devices that never have access to a network connection.
  • Create new mobile geodatabases, tables, and domains.
  • Share datasets between applications using peer-to-peer technology.

Supported data files

ArcGIS Runtime supports the data files listed in the following table:

Data file typeData access APILayer APICan query?Can edit?License level
Vector tile package VectorTileCache ArcGISVectorTiledLayer NoNoLite
Image tile package TileCache ArcGISTiledLayer , ArcGISTiledElevationSource NoNoLite
Mobile geodatabase You can create a geodatabase file (SQLite database) with ArcGIS Runtime, using ArcGIS Pro or ArcMap, or by downloading offline data from a feature service. Geodatabase FeatureLayer YesYesLite
Scene layer package For display in scenes only.N/A Access a Scene Layer Package (.slpk) file directly from the ArcGIS Scene Layer ArcGISSceneLayer NoNoLite
Shapefile ShapefileFeatureTable FeatureLayer YesYesStandard
Local raster file The following raster formats are supported: ASRP/USRP, CIB, CADRG/ECRG, DTED, GeoPackage Raster, GeoTIFF/TIFF, HFA, HRE, IMG, JPEG, JPEG2000, Mosaic Dataset in SQLite, NITF, PNG, RPF, SRTM, CRF, and MrSID. Raster RasterLayer NoNoStandard
OGC GeoPackage (feature data) GeoPackageFeatureTable FeatureLayer YesYesStandard
OGC GeoPackage (raster data) GeoPackageRaster RasterLayer NoNoStandard
OGC KML file (.kml file or compressed .kmz file) KmlDataset KmlLayer NoYesStandard
Electronic Nautical Chart (S-57) For display in maps only. Not supported in scenes. EncCell EncLayer NoNoStandard
Other (e.g. GeoJSON) FeatureCollection FeatureCollectionLayer YesYesLite

Vector tiled layer

Vector tiled layers contain vector representations of data across a range of scales. Unlike raster tiles, they can adapt to the resolution of their display device as you zoom in and out.

When you create a vector tile package, it must be in the same spatial reference as the map in which it will be displayed.

To create a vector tiled layer from the vector tile package (.vtpk), instantiate an ArcGISVectorTiledLayer object with the vector tile package's file URL. The default style will be loaded directly from the vector tile package.

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
void WorkDataFiles::vectorTilePackage()
{
  // Path to the local vector tile package (.vtpk file).
  QString myDocumentsFolder = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).at(0);
  QString tileCachePath(QDir::toNativeSeparators(myDocumentsFolder + "/PencilMapTiles.vtpk"));
  // Create a vector tile cache from the local data.
  VectorTileCache* cache = new VectorTileCache(tileCachePath, this);
  // Use the tile cache to create an ArcGISVectorTiledLayer.
  ArcGISVectorTiledLayer* tiledLayer = new ArcGISVectorTiledLayer(cache, this);
  // Display the vector tiled layer as a basemap.
  m_map = new Map(new Basemap(tiledLayer, this), this);
  m_mapView->setMap(m_map);
}

Image tiled layer

Image tiled layers are typically used to display pregenerated tiled data as basemaps. A tile cache can also be used to provide offline elevation data for visualizing 3D terrain in a scene. You can take a portion of tiled data and store it within a single tile package (.tpk or .tpkx) file for completely disconnected scenarios. To store a portion of tile data as a tile package, you must specify area of interest, the tiling scheme, the levels of detail, and the tile format using one of the following approaches:

  • Run the ArcGIS Pro python tool, Create Map Tile Package, to create a tile package file.
  • In ArcMap, choose File > Share As > Tile Package to create a tile package file, as described in the ArcMap topic, How to create a tile package.
  • In ArcMap, choose Share as > ArcGIS Runtime Content to export the map's basemap layer to a tile package file (.tpk) that is output within the ArcGIS Runtime Content folder. For details, see the ArcMap topic Creating ArcGIS Runtime content, which is available with ArcGIS 10.2.1 for Desktop or later. Also see ArcMap's tile packages.

When you create a tile package, it must have the same spatial reference as the map in which it will be displayed.

To create a tiled layer from a tile package file, instantiate an ArcGISTiledLayer object with the path to the tile package file on the device.

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
void WorkDataFiles::imageTilePackage()
{
  // Path to the local package (.tpkx file).
  QString myDocumentsFolder = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).at(0);
  QString tileCachePath(QDir::toNativeSeparators(myDocumentsFolder + "/StreetMapTiles.tpkx"));
  // Create a tile cache from the local data.
  TileCache* cache = new TileCache(tileCachePath, this);
  // Use the tile cache to create an ArcGISTiledLayer.
  ArcGISTiledLayer* tiledLayer = new ArcGISTiledLayer(cache, this);
  // Display the tiled layer as a basemap.
  m_map = new Map(new Basemap(tiledLayer, this), this);
  m_mapView->setMap(m_map);
}

To create an elevation source from a tile package file, instantiate an ArcGISTiledElevationSource object with the path to the tile package file on the device.

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
void WorkDataFiles::imageTilePackageElevationSource()
{
  QString myDocumentsFolder = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).at(0);
  QString tileCachePath(QDir::toNativeSeparators(myDocumentsFolder + "/WorldElevation3DTiles.tpkx"));
  // Create a tile cache from the local data.
  TileCache* cache = new TileCache(tileCachePath, this);
  // Use the tile cache to create an ArcGISTiledElevationSource.
  ArcGISTiledElevationSource* localElevationSource = new ArcGISTiledElevationSource(cache, this);
  connect(localElevationSource, &ArcGISTiledElevationSource::doneLoading, this, [this, localElevationSource](Error e)
          {
            if (!e.isEmpty())
            {
              qDebug() << e.message() << ": " << e.additionalMessage();
            }
            // Create a surface with the elevation source.
            Surface* elevationSurface = new Surface(this);
            elevationSurface->setElevationExaggeration(2.0);
            elevationSurface->elevationSources()->append(localElevationSource);
            // Set the elevation source as your scene's base surface.
            Scene* scene = new Scene(BasemapStyle::ArcGISCommunity, this);
            scene->setBaseSurface(elevationSurface);
            m_scene = scene;
            m_sceneView->setArcGISScene(scene);
          });
  localElevationSource->load();
}

Feature layer

Feature layers allow you to display, select, edit, and query individual features and their attributes. You can work with features offline using features stored in a data file, such as a mobile geodatabase file (.geodatabase), a GeoPackage file (.gpkg), or a shapefile (.shp). You can edit feature geometry and attributes, and, when using a mobile geodatabase, can also edit attachments and related records.

Mobile geodatabase

Mobile geodatabases (.geodatabase) can be created with ArcGIS Pro (2.7 or later) or ArcMap (10.2.1 or later). At version 100.14, they can also be created in your ArcGIS Runtime app.

To create a mobile geodatabase that you can sideload for use in your app:

To create a mobile geodatabase using ArcGIS Runtime:

To display tables from a mobile geodatabase:

  1. Instantiate the Geodatabase object by opening an existing geodatabase or creating a new one. In either case, you need to specify a path to the .geodatabase file.
  2. Instantiate a FeatureTable from one of the mobile geodatabase's tables or create a new one using a TableDescription and associated FieldDescription objects and calling Geodatabase::createTableAsync() .
  3. Create a new FeatureLayer from the feature table and add it to the map. Optionally, create a new Renderer to symbolize features in the layer. If the layer is based on a new geodatabase table, nothing will appear in the layer until features are created.

The following code opens a geodatabase at the given path. If it doesn't exist, a new geodatabase is created at that location and a new table and domain are added. Finally, the table is displayed as a feature layer in the 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
void WorkDataFiles::featureLayerMobileGeodatabase()
{
  // Get the path to a local geodatabase.
  QString myDocumentsFolder = QStandardPaths::standardLocations(QStandardPaths::TempLocation).at(0);
  QString geodatabasePath(QDir::toNativeSeparators(myDocumentsFolder + "/recreation.geodatabase"));

  // Open the geodatabase if the file exists at the specified path.
  if (QFile(geodatabasePath).exists())
  {
    // Get the geodatabase using the path.
    Geodatabase* localGdb = new Geodatabase(geodatabasePath, this);
    // Wait for the geodatabase to load.
    connect(localGdb, &Geodatabase::doneLoading, this, [this, localGdb](Error loadError)
            {
              if (!loadError.isEmpty())
              {
                qDebug() << "Geodatabase load error: " << loadError.message() << " : " << loadError.additionalMessage();
              }
              // Access one of the feature tables in the geodatabase using its name.
              GeodatabaseFeatureTable* trailheadsTable = localGdb->geodatabaseFeatureTable("Trailheads");
              // Create a feature layer from the table and add it to the map's operational layers.
              FeatureLayer* trailheadsLayer = new FeatureLayer(trailheadsTable);
              m_map->operationalLayers()->append(trailheadsLayer);
            });
    localGdb->load();
  }
  else // If the geodatabase doesn't exist, create it.
  {
    Geodatabase* localGdb = Geodatabase::instance();
    connect(localGdb, &Geodatabase::errorOccurred, this, [](Error e)
            {
              if (!e.isEmpty())
              {
                qDebug() << "Geodatabase load error: " << e.message() << ": " << e.additionalMessage();
              }
            });
    // Output folder must be a read and write location and the filename must have a '.geodatabase' extension.
    auto task = Geodatabase::create(geodatabasePath);
    connect(localGdb, &Geodatabase::createCompleted, this, [this](QUuid /*taskId*/, Geodatabase* geodatabaseResult)
            {
              // Create a new domain in the geodatabase for rating values from 1-10.
              RangeDomainDescription* domainDescription = new RangeDomainDescription("RatingDomain", FieldType::Int16, QVariant(1), QVariant(10), this);
              connect(geodatabaseResult, &Geodatabase::createDomainCompleted, this, [geodatabaseResult, this]()
                      {
                        // Create a table description for a "Trailheads" table that will store points.
                        auto tableDef = new TableDescription("Trailheads", SpatialReference::wgs84(), GeometryType::Point);
                        // Add field descriptions to define "Name" and "Difficulty" fields.
                        tableDef->fieldDescriptions()->append(new FieldDescription("Name", FieldType::Text, this));
                        FieldDescription* difficultyFieldDescription = new FieldDescription("Difficulty", FieldType::Int16, this);
                        difficultyFieldDescription->setDomainName("RatingDomain");
                        tableDef->fieldDescriptions()->append(difficultyFieldDescription);
                        // Create a new trailheads table in the geodatabase using the table description.
                        connect(geodatabaseResult, &Geodatabase::createTableCompleted, this, [this](const QUuid& /*taskId*/, GeodatabaseFeatureTable* featureTableResult)
                                {
                                  // Create a feature layer from the table and add it to the map.
                                  FeatureLayer* trailheadsLayer = new FeatureLayer(featureTableResult);
                                  m_mapView->map()->operationalLayers()->append(trailheadsLayer);
                                });
                        geodatabaseResult->createTable(tableDef);
                      });
              geodatabaseResult->createDomain(domainDescription);
            });
  }
}

GeoPackage

GeoPackage is an open, standards-based, platform-independent, portable, self-describing, compact format for transferring geospatial information. It uses a single SQLite file (.gpkg) that conforms to the OGC GeoPackage standard. You can create a GeoPackage file from your own data using the Create SQLite Database tool in ArcGIS Pro.

To display features stored in a GeoPackage file, you must do the following:

  1. Instantiate the GeoPackage with the .gpkg file path.
  2. Load the GeoPackage and then examine its list of GeoPackageFeatureTable s.
  3. Create a FeatureLayer from one of the GeoPackageFeatureTable s and add it as an operational layer to the 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
void WorkDataFiles::geoPackage()
{
  // Get the path to a local GeoPackage.
  QString myDocumentsFolder = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).at(0);
  QString geopackagePath(QDir::toNativeSeparators(myDocumentsFolder + "/trails.gpkg"));

  // Open the GeoPackage by providing the path.
  GeoPackage* trailsGpkg = new GeoPackage(geopackagePath, this);
  // Wait for the GeoPackage to load.
  connect(trailsGpkg, &GeoPackage::doneLoading, this, [this, trailsGpkg](Error e)
          {
            const auto tables = trailsGpkg->geoPackageFeatureTables();
            // Iterate feature tables in the package to find one by name.
            for (GeoPackageFeatureTable* table : tables)
            {
              if (table->tableName().toLower() == "trailheads")
              {
                // Create a feature layer from the table and add it to the map's operational layers.
                FeatureLayer* trailheadsLayer = new FeatureLayer(table, this);
                m_mapView->map()->operationalLayers()->append(trailheadsLayer);
              }
            }
          });
  trailsGpkg->load();
}

Shapefiles

A shapefile is a vector data storage format that contains geometry and attribute data for geographic features. Despite the name, a shapefile dataset is composed of at least four physical files: .shp, .dbf, and .shx. A shapefile may include several other files, such as projection information, spatial indices, attribute indices, and so on.

To create a feature layer from a shapefile (.shp), do the following:

  1. Instantiate the ShapefileFeatureTable with the path to the shapefile. This path must point to the .shp file. The .shp file's associated files (.shx, .dbf, and so on) must be present at the same location.
  2. Create a FeatureLayer from the ShapefileFeatureTable and add it to the 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
void WorkDataFiles::shapeFile()
{
  // Get the path to a local shapefile.
  QString myDocumentsFolder = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).at(0);
  QString shapefilePath(QDir::toNativeSeparators(myDocumentsFolder + "/trails.shp"));
  // Create a shapefile feature table using the path.
  ShapefileFeatureTable* trailsFeatureTable = new ShapefileFeatureTable(shapefilePath, this);
  connect(trailsFeatureTable, &ShapefileFeatureTable::doneLoading, this, [this, trailsFeatureTable](Error e)
          {
            if (!e.isEmpty())
              qDebug() << e.message() << ": " << e.additionalMessage();
            // Create a feature layer from the table and add it to the map's operational layers.
            FeatureLayer* trailsLayer = new FeatureLayer(trailsFeatureTable);
            m_mapView->map()->operationalLayers()->append(trailsLayer);
          });
  trailsFeatureTable->load();
}

Raster layer

Raster data consists of a matrix of cells in which each individual cell contains a value representing information. For example, satellite or aerial images and photographs for visualizing an area. You can define renderers to display the raster data. ArcGIS Runtime supports several raster formats. To work offline, copy the raster data onto your device and add the raster dataset to your app using the Raster class. For more information and a list of supported raster formats, See Add raster data.

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