Data files

Data files

What is a data file?

A data file is a local file stored on a device that contains data that can be displayed by a layer in a map or scene. Some data files also support editing, querying, and analyzing data. Data files can be created using a number of tools or scripts, or downloaded from the internet.

You use data files to create offline applications that:

  • Display maps or scenes without a network connection.
  • Can access, display, and analyze data sideloaded onto a device.
  • Include data with an application install.
  • Collect data on devices that never have access to a network connection.
  • Share datasets between applications using peer-to-peer technology.

Types of data files

The following types of data files are supported directly by the ArcGIS Maps SDKs for Native Apps:

Data file typeData access APILayer APICan query?Can edit?License level
Vector tile packageVector Tile CacheArcGIS Vector Tile LayerNoNoLite
Map tile packageTile CacheMap Tile LayerNoNoLite
Mobile geodatabaseMobile GeodatabaseFeature LayerYesYesLite
Scene Layer PackageAccess a Scene Layer Package (.slpk) file directly from the ArcGIS Scene LayerArcGIS Scene LayerNoNoLite
ShapefileShapefile Feature TableFeature LayerYesYesStandard
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.
RasterRaster LayerNoNoStandard
OGC GeoPackage (feature data)GeoPackage Feature TableFeature LayerYesYesStandard
OGC GeoPackage (raster data)GeoPackage RasterRaster LayerNoNoStandard
OGC KML fileKML DatasetKML LayerNoYesStandard
Electronic Nautical Chart (S-57)
For display in maps only. Not supported in scenes.
ENC CellENC LayerNoNoStandard
Other (e.g. GeoJSON)Feature CollectionFeature Collection LayerYesYesLite

Files created by ArcGIS (vector tile packages, image tile packages, mobile geodatabases, and scene layer packages) can be used with a free Lite license. Files that require custom parsing code and are used with a Feature Collection Layer can also be used with a free Lite license. Other files require a Standard license.

How to work with data files

The general workflow to work with a data file in an offline application is:

1. Create

To begin working with a data file, you need to have one of the supported data files. You can either create your own data files using ArcGIS Pro, tools, and scripts, or download public data files from the internet.

When choosing a data file to host in your offline app, make sure that its type is also supported by your license level. A license is needed for when you want to deploy your app to production. Some data files such as vector tile package, image tile package, and mobile geodatabase are supported by the Lite license, which is the lowest level license. Meanwhile, to use shapefiles, OGC GeoPackage, KML files, or local raster files, you need a Basic license.

The typical steps to create a data file are:

  1. Determine the data file you will need in your offline app from the list of supported data files.
  2. Use tools in ArcGIS Pro or the portal to import dataset.
  3. Export into the desired data file format.

2. Manage

Once you have your data file, you sideload or download it onto a device. You can then access it directly from local storage. Optionally, you can also include the data file in your application build folder and reference the folder path in your offline app.

The typical steps to manage a data file are:

  1. Transfer the data file onto your device through sideloading or including it in the application build folder.
  2. Keep note of the location path of the data file, since you will need to reference it in the application code.

3. Access

To display a data file in your offline app, you typically start with a layer that references the shapefile (either in your device or included in the application build), and add the layer to a map or scene.

Once you have your data file displayed in your offline app, you can perform additional capabilities as supported by your file type. Some types of data file support editing, such as mobile geodatabases and shapefiles, while others are read-only. Shapefiles and mobile geodatabases also allow you to perform SQL queries on them. Additionally, you can apply a renderer to define symbols for features in the layer. Shapefiles, GeoPackages, and mobile geodatabase tables only have a default renderer with black solid symbols when first applied to a layer.

The typical steps to access a data file (in this case, a shapefile) are:

  1. Set up your project using one of the ArcGIS Maps SDKs for Native Apps for your platform of choice within your preferred IDE.

  2. Create a ShapefileFeatureTable referencing the shapefile in local storage.
  3. Create a FeatureLayer with the ShapefileFeatureTable.
  4. Add the FeatureLayer to a Map displayed in a MapView.

Code examples

Display a shapefile

After you create and manage your data file (in this case, a shapefile), you can access it in your offline app.

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 (C++)
Use dark colors for code blocksCopy
1
2
3
4
5
6

var shapefileTable = new ShapefileFeatureTable("\\path\\to\\shapefile.shp");

var shapefileLayer = new FeatureLayer(shapefileTable);

MainMapView.Map.OperationalLayers.Add(shapefileLayer);

Display features from an OGC GeoPackage

After you create and manage your data file (in this case, an OGC GeoPackage), you can access it in your offline app.

Steps

  1. Set up your project using one of the ArcGIS Maps SDKs for Native Apps for your platform of choice within your preferred IDE.

  2. Create a GeoPackage referencing the GeoPackage file in local storage.
  3. Load the GeoPackage to read its contents.
  4. Get a GeoPackageFeatureTable from the GeoPackageFeatureTables collection in the GeoPackage.
  5. Create a FeatureLayer with the GeoPackageFeatureTable.
  6. Add the FeatureLayer to a Map displayed in a MapView.
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 (C++)
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
try
{
    var geoPackage = await GeoPackage.OpenAsync("\\path\\to\\geopackage.gpkg");
    await geoPackage.LoadAsync();

    foreach (var table in geoPackage.GeoPackageFeatureTables)
    {
        var featureLayer = new FeatureLayer(table);
        MainMapView.Map.OperationalLayers.Add(featureLayer);
    }
}
catch(Exception ex)
{
    // Handle error
}

Query features in a shapefile (SQL)

After you create, manage, and access your shapefile, you can query features in it.

Steps

  1. Create a ShapefileFeatureTable referencing the shapefile in local storage.
  2. Create a QueryParameters object and set a whereClause.
  3. Call QueryFeaturesWithParameters on the ShapefileFeatureTable.
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 (C++)
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
try
{
    var shapefileTable = await ShapefileFeatureTable.OpenAsync("\\path\\to\\shapefile");

    var queryParameters = new QueryParameters { WhereClause = "Shape__Length > 150" };

    var queryResult = await shapefileTable.QueryFeaturesAsync(queryParameters);

    foreach(var feature in queryResult)
    {
        double shapeLength = (double)feature.Attributes["Shape__Length"];
        // do something with shapeLength value
    }

}
catch (Exception ex)
{
    // Handle error
}

Tutorials

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.