Mapbox mbtiles layer not loading without "network" connection

1. What is the problem? Be very detailed.

I am using a geopoint widget with style ‘maps’ to collect data and have a raster base layer I created that includes a basemap plus ‘survey points’ overlain (so I can navigate to predetermined points). It works really well avoiding the need to open a separate app with the survey point data loaded... However there is a problem with viewing the raster layer in certain circumstances.

I have loaded the raster MBTiles layer onto my phone in /odk/layers and in General Settings selected map type as:
Basemap
Source: MapBox
Mapbox map style: Outdoors

Reference Layer
Layer data file: [myfile.MBTiles] (raster format)

I created the MBTiles file with zoom levels 12 - 18

When filling a form with a geopoint widget, type 'map' the reference layer does not show up at any zoom levels unless I have a network connection. Once I have viewed the map online tiles have been cached, the MBTiles layer is then displayed as expected at the different zoom levels. This then works offline. If I move to an area that has not been viewed whilst online the map only displays the raster MBTiles at the zoom level available in the cache, not in the file (i.e. pixelated if I zoom beyond the cached level). So in order to view this locally stored data I need a network connection. I am working in an area with no mobile connection. And this isn’t behaving as an offline map, if I need to have viewed every tile at every zoom level prior to working offline... It also means that anyone else sharing this form would need to know that the map won’t load, and it could be too late once out in the field!

2. What app or server are you using and on what device and operating system? Include version numbers.

Collect 1.23.3

3. What you have you tried to fix the problem?

If I connect to the internet via WiFi or 4G I can get the raster MBTiles to show at different zoom levels, which are then cached.

If I tether my phone to another phone which is behaving as a hotspot, the map loads at every zoom level within the MBTiles file, irrespective of whether there is an internet connection on the second phone – i.e. it is not actually dependent on having mapbox base layer data available at that zoom level. Once these tiles have been loaded to cache, the map opens next time at all zoom levels that have been viewed whilst tethered (even if the phone is no longer tethered) – i.e. it appears to be loading from a cache, not reading the MBTiles file directly.

4. What steps can we take to reproduce the problem?

Create MBTiles raster file, place in layers folder, try opening a geopoint with the layer whilst offline – it won’t appear.

Connect to internet or tether to a second phone (fool your phone into thinking it is connected via WiFi) – the MBTiles map will appear.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

I discovered the tethering 'trick' purely by luck, and it might not be an expected feature! So if this is the only way to get it to work, please don't 'fix' it by blocking this work around.

Hi,
I'm not sure if you found the solution. But you have to place the .MBtiles inside a folder. Pasting it simply within the layers folder doesn't show the offline layer file.

Example: Place it within /odk/layers/mapboxlayer/myfile.MBtiles rather than pasting it directly in /odk/layers/myfile.MBtiles

Hope it helps.

Thanks, Vijay

I am facing the same problem here, using a sub-directory or not, does not change anything.
It is necessary to use data connection to show the mbtile layer?
The problem occurs on 1.24.1, 1.25.1 and and 1.26.0 beta versions.

Have you tried opening the widget with data or a dummy 'tethered' connection? With my device this issue no longer seems to occur for new mbtile layers that I add to the device. I don't place the file(s) in a subdirectory.

I am uncertain whether turning on data / tethering 'fixed' the issue, but I have just got into the habit of checking the mbtile layer whilst still connected to my wifi before going into the field, so may have just got a work around rather than fixed it.

Sadly not. If I start at the office with wifi or data connection, when I switch data connection off my maps disappears :frowning:

Thanks for your patience here, looking into this issue has been on my backlog for a while. @zestyping has taken a look and confirmed that there's a bug. We'll keep you updated on a timeline for a fix.

1 Like

No problem @LN :grinning: For the moment we can always use openstreetmap engine to show our map offline. Thanks a lot.

1 Like