Layers of data can be sourced from either online services such as ArcGIS Online, WFS, or WMS, or offline sources such as mobile geodatabases, shapefiles, GeoPackages, tile packages, and raster datasets. Using ArcGIS Pro and ArcMap, you can create these GIS files and packages and deliver them via email, FTP, the cloud, networks, thumb drives, and so on. The recipient just copies (or sideloads) the files and directories onto their device so that the ArcGIS Runtime apps can work offline without a network connection.
ArcGIS Runtime supports the following offline layers:
- Tiled layer data stored in tile packages (.tpk or .tpkx).
- Vector tiled layer data stored in vector tile packages (.vtpk).
- Feature layer data stored in the following formats:
- ArcGIS features held in a mobile geodatabases (.geodatabase).
- Features stored in a GeoPackages provisioned by the OGC file format (.gpkg).
- Features stored in the shapefile format provided by the .shp file and its associated files (.dbf, .shx, and so on).
- Raster layer data stored in a raster dataset file or in a GeoPackage (.gpkg).
ArcGIS Pro and ArcMap provide a range of tools to create these GIS files and packages. The following sections demonstrate how you prepare these data files, add them to your ArcGIS Runtime app, and create layers to display in your map.
Tiled layers are typically used to display pregenerated tiled data as basemaps. These give geographical context to operational layers and graphics in your map. You can take a portion of tiled data offline and store it within a single tile package (.tpk or .tpkx) file. To do this, you need to specify area of interest, the tiling scheme, the levels of detail, and the tile format. You can do so by using any of the following tools:
- 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 How to create a tile package help topic.
- 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. This is described in the Creating ArcGIS Runtime content help topic, which is available with ArcGIS 10.2.1 for Desktop or later.
Review this document for more information about 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.
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. You can take an area of vector tiled data offline by exporting the vector tiles to a vector tile package file (.vtpk) using the Create Vector Tile Package tool in ArcGIS Pro. Be aware that ArcGIS Pro does not support custom styles and only packages the default styles into the vector tile package.
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.
Feature layers allow you to display, select, and query individual features and their attributes. If supported, you can also edit features, their attributes, and their attachments. The desktop pattern allows you to work with features offline using cached features stored in an offline file, such as a geodatabase file (.geodatabase), a GeoPackage file (.gpkg), or a shapefile (.shp).
To generate a mobile geodatabase, use the Share as > ArcGIS Runtime Content menu item as described in the ArcMap help topic Creating ArcGIS Runtime content. This is available with ArcGIS for Desktop 10.2.1 or later.
To create an offline feature layer from a mobile geodatabase (.geodatabase), complete the following steps:
- Instantiate the Geodatabase object with a path to the geodatabase file.
- Load the geodatabase and instantiate a FeatureTable from one of the geodatabase's feature tables.
- Create an FeatureLayer from the FeatureTable and add it as an operational layer to the map.
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 (.gpkg) 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:
- Instantiate the GeoPackage with the .gpkg file path.
- Load the GeoPackage and then examine its list of GeoPackageFeatureTables.
- Create a FeatureLayer from one of the GeoPackageFeatureTables and add it as an operational layer to the map.
To create a feature layer from a shapefile (.shp), do the following:
- Instantiate the ShapefileFeatureTable with the path to the shapefile. This path must point to the .shp file and the associated .shx and .dbf files must be present at the same location.
- Create an FeatureLayer from the ShapefileFeatureTable and add it as an operational layer to the map.
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. This SDK supports several raster formats. To work offline, just copy these onto your device and add the raster dataset to your app using the RasterLayer class. See Add raster data for more information.