Using Offline Maps¶
Collect's geopoint, geotrace, and geoshape questions 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.
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 (with data in Mapbox Vector Tile format (pbf)) are only supported if Mapbox is selected as the basemap source.
- 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 or create your MBTiles file with TileMill or other software.
- Transfer tiles to devices. The MBTiles file must be placed on your device in the
layerssubdirectory of your Collect directory, and the filename must end in .mbtiles.
- Select your offline layer in the reference layer settings.
- Open a geopoint, geotrace, or geoshape question.
- 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.
Getting map tilesets¶
For non-commercial community mapping activities, Mapbox can arrange for offline MBTiles, including processed streets, satellite, and custom data. Contact community[at]mapbox.com for offline Terms of Service exemptions and to receive technical guidance.
To create MBTiles files, use one of the compatible applications . Commonly used free software packages are TileMill and QGIS with the QTiles plugin. 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.
If you have existing geospatial data that is not in an MBTiles file, you may be able to convert it for use in Collect. For example, Tippecanoe is a tool to build vector MBTiles files from GeoJSON features (see warning above: vector MBTiles files are only supported with Mapbox basemaps and are 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.
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
- by tapping on the button that looks in a stack of layers in a geopoint, geotrace, or geoshape question
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.