Skip to content

Creating Offline Maps

Technical guide

This guide contains instructions of a technical nature that are intended for experienced computer users. If you are unsure about how to follow this guide please seek help from a friend or colleague.

MilGPS supports displaying user supplied offline maps in raster MBTiles format.

MilGPS does not support creating MBTiles files in the app but many third party tools are capable of reading and writing MBTiles files.

This page explains how to use the free, open source QGIS application to generate a raster MBTiles file from an online mapping source.

1. Install QGIS

Download and install QGIS by following the instructions on the QGIS download page.

MacOS users who have homebrew installed can install QGIS by running brew install qgis.

2. Find a map source

Many map sources are available online. You'll need to find a map source that offers the type of map you want for your region of interest with an acceptable licence for offline use.

Generally you will find suitable free map sources from governments and open mapping organisations, whereas the maps of commercial providers will require payment or are not available outside of their own services. For example, it is not possible to download Apple or Google maps for offline use.

Ensure your use of a map source is permitted

You must carefully review the licensing terms and terms of service of any map provider you are considering and ensure that you have permission to access their maps and download them for offline use. In subsequent steps you will download map tiles directly from the map provider and doing this without permission may result in the provider taking legal action against you or possibly even criminal penalties.

If in doubt, contact the map provider and ask them if you can download their maps for offline use before downloading any tiles.

For the rest of this guide we will use USGS Topo maps as our map source. These maps are published by the USGS and are in the public domain.

3. Add the map source to QGIS

Open the USGS Topo map page and copy the URL for the WMTS service.

USGS Topo WMTS link

In QGIS, right-click on the "WMS/WMTS" item in the browser pane and click "New Connection". Enter a name for the source and paste the URL to the WMTS XML file that we copied above.

QGIS new connection

Expand the newly added connection and right click on the "GoogleMapsCompatible" layer. Click "Add Layer to Project".

Pan/zoom the map to the USA and verify that the map is appearing correctly.

QGIS USGS Topo

4. Export a region as an MBTiles file

Pan/zoom the map to the region you want included in your MBTiles file.

Open the "Processing Toolbox" by clicking the gear icon on the toolbar.

QGIS processing toolbox

Expand "Raster Tools" and double click "Generate XYZ tiles (MBTiles)".

QGIS generate mbtiles

Click the button next to the "Extent" field to set it to the area currently displayed on screen, or use the dropdown "Draw on Map Canvas" to choose a different region by drawing a rectangle on screen.

Choose minimum and maximum zoom levels for the MBTiles file. You should only choose levels that are provided by your map source. Keep in mind that each extra level of detail you add will add four times as many tiles as the previous layer.

For output format, choose PNG for topographic or street map styles and JPG for satellite imagery.

Finally, choose a location to output the MBTiles file and click "Run". This step may take some time depending on the size of the area you selected.

Choose a small region and the lowest acceptable zoom level

When you press the "Run" button your computer will systematically download the map tiles for the region you have selected. As you are downloading from a shared resource, excessive usage may impact others and/or result in the map provider blocking or rate limiting you. Only download tiles for small areas and at the minimum zoom levels you require.

We suggest not exceeding a 50x50km region and specifying a maximum zoom level no higher than 15. Assuming a topographic style map this will result in an approximately 400MB MBTiles file.