I've discussed this elsewhere in the past, but essentially;
For a survey form that for various reasons requires the use of different offline layers;
the survey covers areas far apart but the required offline layer has high zoom levels so it's space efficient and faster to render a tileset for each separate area (eg 10s to 100s of km apart and Z0-22 levels)
there are different elevations at the same location with a layer for each one (eg 1F/2F/3F)
the survey covers different aspects that rely on differing overlays to an offline layer that would be cluttered in a single layer (eg aboveground vs underground infrastructure)
When opening the map widget, for that particular question Collect will select the offline layer based on a previous question or hard coded to a particular layer, and if the layer doesn't exist then return a warning and default to none/last selected (But ideally having these filenames is like images and requires upload to Central as attachments! - I know this is beyond current scope)
hard coded: parameter or similar as LocationA_1F.mbtiles
dynamic: parameter or similar as ${selected_tileset} where the selection name is the tileset filename or a lookup against a selected value to return the tileset filename instance('survey_sites')/root/item[name=${location} and elevation=${elevation}]/tileset
I think it's probably feasible, but I'd need to check what Android's file picker allows us to do. Either way, it's something I think we could look at after adding the ability to add one at a time rather than as part of this initial work.
Just wondering if there has been any progress on incorporating this feature into the production model of ODK Collect. I am about to embark on another data collection exercise where I can't get access to the protected folder.
Maybe I missed something in the latest version but can't see a function available - is there a likely time line. Sorry if this sounds like impatience - it's hunger...
I have been testing the mbtiles loading feature currently in 2024.2.0-beta.2.
It's fantastic - thanks for all the hard work on this by everyone involved
Some testing feedback (Pixel 6a, Android 14, GrapheneOS):
Loading an .mbtiles file works exactly as expected, copying to the correct directory, either project specific or the global layers directory.
When I load a file that does not have .mbtiles extension (e.g. a .txt file), it fails silently without an error message - is this expected behaviour?
When I load an mbtiles for a specific project, then load the same file again for all projects, the file is copied to both the project-specific directory and global layers directory. However only one entry is displayed on the layer selector.
I assume this behaviour is fine, but it does mean there is file duplication (possibly relevant for the planned layer deletion feature).
I assume if a file of the same name, but different content, is loaded then the mbtiles file would be overwritten. This allows for inplace updates of a modified basemap.
Tested adding multiple mbtiles to a project without issues.
Hi @spwoodcock
thanks a lot for testing and sharing your thoughts!
Yes, our goal was to filter out other types of files and not even allow users to select them but that's not doable using the built-in Android file picker.
So instead, we allow selecting different types of files too but then we ignore them. We might want to add some type of notification to clarify this behavior but we haven't decided yet.
I would need to double check but I believe this is not a new behavior. If you did the same with older versions of ODK Collect (for example copying layers via adb), then only one of those files was displayed.
Thanks to everyone who has participated in designing and testing this functionality!
Starting in Collect v2024.2.0, you can now import MBTiles offline layers from Collect without having to manually place files in the layers directory. See the release announcement for a short video and a link to new documentation.