Caching Imagery from a WMTS for Offline Use

I’ve been shifting more and more of my field mapping from Avenza to qField, once I got qField working and syncing properly there’s really no comparison between the two. At the moment, I am primarily using the basic cable/file transfer sync option, rather than qFieldCloud.

One thing I am still running into, however, is that if I want a truly offline project, I have to put everything I want on my device, including aerial imagery. We have some projects that cover a pretty wide area, so although I can clip a portion of an NAIP aerial and load that onto the device as part of the project, that often takes up several gigabytes of storage space, and if you’re working on multiple projects at once, that eats up memory pretty quickly on a mobile device.

The question I have is this - Is there a way to cache imagery data from a WMTS for later use? As long as I have cell service, using a WMTS layer for my imagery works great, and I’ve found that, as long as I have the same instance of the app and project open, qField actually does cache some WMTS data, i.e I can open the app on a hilltop where I have service, zoom in on my area, then head down the hill, drop out of service, and still be able to see the tiles that I loaded when I had service. Unfortunately, the moment I close the app, or even back out to the project screen and re-enter the project, I see the following message

Some of the folks at my company are still using PC-GPS, which uses an app provided aerial basemap, and as long as you’ve zoomed in and looked at the imagery for the area you expect to be using offline, when you are offline that imagery will still be cached on the device, albiet at the extent and resolution that you recently looked at it.

Is there any way in the current interation of qField to do something similar, i.e. to cache data for later use from a WMTS?

If anyone has any thoughts or ideas I’d be delighted to hear them. Thanks!


Imported from GitHub discussion by @seades0630 on 2024-04-01T19:52:28Z

seades0630 , QField does cache tiles, however it cannot cache the GetCapabilities request when opening a project and initializing WMS/WMTS layers. That being said, if you can replace your WMTS layer with its XYZ equivalent, that will work.

In terms of space management for large datasets, you can also share these across multiple projects using localized paths functionality. Have you looked into this? See the documentation here: Shared local datasets - QField Ecosystem Documentation


Imported from GitHub comment by @nirvn on 2024-04-02T00:41:43Z

I’m currently exploring options for getting a “true” offline basemap with aerial photography. seades0630 did you manage to find a solution or workaround for this? Or possibly an example of an implementation using the outside layers feature?


Imported from GitHub comment by @carterpeel on 2024-04-12T14:10:30Z

carterpeel Yes, I did find a solution! Per nirvn 's suggestion, XYZ servers do exactly what I was looking for. They’re a tad bit more difficult to find than WMS or WMTS servers, but there are plenty of them. You can find them with a google search, but there’s also a QGIS plugin, QuickMapServices, that has quite a few server addresses already loaded in, including ESRI’s imagery server.

If you’ve ever added WMTS or WMS servers to a project in the Data Source Manager, the process to add an XYZ server is very similar. And as long as you look at the area you’re hoping to have stored for offline use while you still have wifi or data, the caching system seems to work fine for being offline, out in the field. I’m quite pleased with the result, it was exactly what I was looking for.

The only issue I’ve run into with them in the two weeks I’ve been experimenting with them, certain servers simply don’t seem to work on qfield (notably, the google imagery server https://www.google.cn/maps/vt?lyrs=s189&gl=cn&x={x}&y={y}&z={z} works fine on desktop but doesn’t seem to work at all in qfield)

Hope that helps!

Seth Eades


Imported from GitHub comment by @seades0630 on 2024-04-18T21:14:10Z