Skip to content

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.
  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 file formats

The following data files are supported:

Data file typeData access APILayer APICan query?Can edit?License level
Vector tile package VectorTileCacheArcGISVectorTiledLayerNoNoLite
Image tile packageTileCacheArcGISTiledLayer, ArcGISTiledElevationSourceNoNoLite
Mobile geodatabase. You can create a mobile geodatabase file (SQLite database) with this API, using ArcGIS Pro, or by downloading offline data from a feature service.GeodatabaseFeatureLayerYesYesLite

| Scene layer package. For display in scenes only. | N/A. Access a Scene Layer Package (.slpk) file directly from the ArcGIS Scene Layer. | ArcGISSceneLayer | No | No | Lite | | Shapefile | ShapefileFeatureTable | FeatureLayer | Yes | Yes | Standard | | 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| No | No | Standard | | OGC GeoPackage (feature data) | GeoPackageFeatureTable() | FeatureLayer | Yes | Yes | Standard | | OGC GeoPackage (raster data) | GeoPackageRaster | RasterLayer | No | No | Standard | | OGC KML file (.kml file or compressed .kmz file) | KMLDataset | KMLLayer | No | Yes | Standard | | Electronic Nautical Chart (S-57). For display in maps only. Not supported in scenes. | ENCCell | ENCLayer | No | No | Standard | | Other (e.g. GeoJSON) | FeatureCollection | FeatureCollectionLayer | Yes | Yes | Lite |

Vector tile package

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 loads directly from the vector tile package.

If you have copied the vector tile package file into the app's documents folder, you can instantiate a vector tiled layer with the following code:

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
        // Creates a new map with vector tile package as the basemap.
        let documentPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
        let vtpkPath = documentPath.appendingPathExtension("myVectorTileCache.vtpk")

        // Instantiates a vector tiled layer with the path to the vtpk file.
        let localVectorTiledLayer = ArcGISVectorTiledLayer(url: vtpkPath)
        map = Map(basemap: Basemap(baseLayer: localVectorTiledLayer))

Image tile package

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 the following approach:

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

Once you have the .tpk or .tpkx file, you can add it to your app using a path or using the documents folder.

Use a path

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 the documents folder

If you have copied the tile package file into the app's documents folder, you can instantiate a tiled layer.

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
        // Path to the local package (.tpk or .tpkx file).
        let documentPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
        let tileCachePath = documentPath.appendingPathExtension("StreetMapTiles.tpkx")

        // Creates a tile cache from the local data.
        let tileCache = TileCache(fileURL: tileCachePath)

        // Uses the tile cache to create an ArcGISTiledLayer.
        let tiledLayer = ArcGISTiledLayer(tileCache: tileCache)

        // Creates a map using the tiled layer as a basemap.
        map = Map(basemap: Basemap(baseLayer: tiledLayer))

Create elevation source from tile package

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
        // Path to the local package (.tpk or .tpkx file).
        let documentPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
        let tileCachePath = documentPath.appendingPathExtension("WorldElevation3DTiles.tpkx")

        // Creates a tile cache from the local data.
        let tileCache = TileCache(fileURL: tileCachePath)

        // Use the tile cache to create an ArcGISTiledElevationSource.
        let localElevationSource = ArcGISTiledElevationSource(tileCache: tileCache)

        // Creates and adds a surface with the elevation source.
        let elevationSurface = Surface()
        elevationSurface.addElevationSource(localElevationSource)

        // Sets the elevation surface into your scene as its base surface.
        let scene = Scene()
        scene.baseSurface = elevationSurface

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. At version 100.14, they can also be created with this SDK.

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

To create a mobile geodatabase with this SDK:

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.makeTable(description:).
  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.

If you have copied the geodatabase file into the app's documents folder, you can instantiate a feature layer.

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
        // Adds an offline feature layer to your map.
        let documentPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
        let geodatabasePath = documentPath.appendingPathExtension("Trails.geodatabase")

        // Instantiates geodatabase with the path to the .geodatabase file.
        let geodatabase = Geodatabase(fileURL: geodatabasePath)

        // Loads the geodatabase.
        try await geodatabase.load()

        // Once loaded, instantiate the feature layer from one of the geodatabase feature tables
        let featureTable = geodatabase.featureTable(named: "Trailheads")!
        let featureLayer = FeatureLayer(featureTable: featureTable)
        map.addOperationalLayer(featureLayer)

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 an GeoPackage with the .gpkg file path.
  2. Load the GeoPackage and then examine its list of GeoPackageFeatureTable()s.
  3. Create an FeatureLayer from one of the GeoPackageFeatureTable()s and add it as an operational layer to the map.

If you have copied the geopackage file into the app's documents folder, you can instantiate a feature layer.

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
        // Adds an offline feature layer to your map.
        let documentPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
        let geopackagePath = documentPath.appendingPathExtension("Trails.gpkg")

        // Instantiates geopackage with the path to the .gpkg file.
        let geopackage = GeoPackage(fileURL: geopackagePath)

        // Loads the geopackage.
        try await geopackage.load()

        // Once loaded, add the first feature layer from the geopackage to the map.
        if let geopackageTable = geopackage.featureTables.first {
            let featureLayer = FeatureLayer(featureTable: geopackageTable)
            map.addOperationalLayer(featureLayer)
        }

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 three 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.

If you have copied the shapefiles into the app's documents folder, you can instantiate a feature layer.

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
        // Adds a shapefile to your map.
        let documentPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
        let shapefilePath = documentPath.appendingPathExtension("trails.shp")

        // Instantiates shapefile feature table with the path to the .shp file.
        let shapefileTable = ShapefileFeatureTable(fileURL: shapefilePath)

        // Creates a feature layer for the shapefile feature table.
        let shapefileLayer = FeatureLayer(featureTable: shapefileTable)

        // Adds the layer to the map.
        map.addOperationalLayer(shapefileLayer)

Raster layer

Raster data consists of a matrix of cells in which each individual cell contains a value representing information. You can visualize this raster data by defining specific renderers. Several raster formats are supported that allow you to use data from satellite and aerial images or photographs, for example. 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, 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.