Using Offline Maps#
Collect's location question types, select from map question, and filled form map can be configured to display different map data. The Maps Settings let you select a basemap to show, as well as a reference layer to show on top of the basemap. Those settings are shared between all mapping components in a single project.
The data for all the available basemaps comes from services on the Internet, so the basemap will only be visible to users who are online. To choose a basemap, select a Source and then a Style if multiple styles are available.
For the reference layer, however, you can select a file on the device, and it will be visible offline. Offline layers are useful to present custom geospatial data layered over standard basemaps or as basemaps for low-connectivity environments. Use them to display high-resolution imagery, annotated maps, heatmaps, and more. ODK Collect can display any map layer saved as a set of tiles in the MBTiles format.
Vector MBTiles are currently displayed without styling. Each layer's lines are displayed in a different color picked by ODK Collect. This color will be the same across all devices using the same MBTiles file. Fills are not displayed.
Offline maps quick start#
Get your MBTiles files.
Select your offline layer in the reference layer settings.
While viewing the map, you can also select the offline layer using the button that looks like a stack of layers.
MBTiles files typically contain metadata that specifies the range of zoom levels in which they are visible. If you are viewing at an appropriate zoom level, your offline layer should be displayed. If you don't see it, you might need to zoom in or out until the zoom level is in the range specified by the MBTiles file.
If the tileset has transparency (PNG or PBF tiles only), the selected basemap will show through. If it does not have transparency or you are offline, only your offline layer will be displayed.
Watch a step-by-step video showing how to add offline tiles from QGIS into Collect.
Getting map tilesets#
To create MBTiles files, use QGIS or MapTiler. In general, you should build raster (jpg or png) MBTiles files. Vector (pbf) MBTiles files are only supported with Mapbox basemaps and are currently displayed without styling.
Transferring offline tilesets to devices#
MBTiles files must be manually transferred to Android devices to be available to Collect. Place the MBTiles files in the
layers subdirectory of your Collect directory, and ensure their filenames end in .mbtiles.
To transfer files, you can upload them to an online service such as Google Drive, connect your device to a computer and transfer them via USB, or use adb.
It is possible to add MBTiles files to a specific project (then the location should be
/sdcard/Android/data/org.odk.collect.android/files/projects/<projectName>/layers) or share between projects by placing them in
Selecting offline tilesets#
Once an MBTiles file has been transferred to the
layers subdirectory of your Collect directory, it will be available for selection as a reference layer. A reference layer provides useful reference information for a data collector. A reference layer with no transparency acts like a basemap.
There are two ways to set the reference layer:
from Maps Settings
Both options set the reference layer for all geopoint, geotrace, and geoshape questions. The choices in the Collect layer selection menu will show the name of the tileset (from the Metadata table in the MBTiles file), as well as the path to the file.