Support PMTiles format on maps for support across Collect + Web Forms

What high-level problem are you trying to solve?

Apologies for three ideas threads in a row :laughing: This is part of a larger geo discussion most likely.

  • So MBTiles are great. However, they are essentially an SQLite DB, and cannot be loaded on the web without bundling WASM libraries.
  • PMTiles are a web-optimised equivalent to MBTiles, with many advantages*. They are having large adoption in the geospatial community, and are promoted by the Cloud Native Geo Foundation.
  • In order to converge on the same standard for loading base layers between both Collect and Web Forms, this would be a good format to promote.
  • There is great support in mapping libraries on both web (leaflet, openlayers, maplibre), and map engines on mobile (maplibre-native, etc).
  • Converting between from existing mbtiles to pmtiles is super simple with a CLI tool.
  • Tools like Tippecanoe (the standard for generating vector tiles), can output both PMTiles and MBTiles.
  • One downside if that QGIS does not have native support to drag-and-drop PMTiles yet, see this thread

*advantages of PMTiles

  • Internal tile deduplication (i.e. if you have lots of blue water tiles, only one is stored, then the remaining tile areas just reference that).
  • Storing millions of tiles (planet scale data) inside a single format is possible, with HTTP RANGE requests to only get the data you need from the archive (fully cloud-optimised, but also work offline if you have the file).
  • Many others

Any ideas on how ODK could help you solve it?

I mentioned this is part of a bigger discussion on geo, as it involves the selection of mapping engine for both Collect and WebForms:

  • As discussed at the Summit, Collect currently has a very nonoptimal usage of google/mapbox/osm map engines all in one app - 3 map engines to maintain. This could possibly be consolidated into a single map engine in future such as maplibre-native. The way I see it, Google / Mapbox / OSM are data providers and not map engine developers (sure, Google and Mapbox develop their own proprietary map engines as part of the package).
  • Web Forms will probably be taking a decision for which web mapping library to use too. The prototype used OpenLayers, which is an excellent multi-purpose web-mapping platform. Although, considering the subset of features required by ODK forms (no need for reprojections, geospatial functions, advanced styling), then Leaflet has a smaller bundle size and would probably suffice.
  • Both Leaflet (via official plugin) and maplibre-native support PMTiles.
  • Using PMTiles would make basemap usage interchangable between Collect and Web Forms.
    • When online, PMTiles could be streamed from any server or S3 bucket (making it possible as a form attachment!).
    • When offline, the PMTiles could be downloaded to the device and used in pretty much the same way as online (I do this all the time). For Collect, it could be downloaded to the sandboxed android storage and used. For Web Forms, it could be downloaded and loaded from OPFS browser storage (I have tested and use this myself).

I'm not expecting a change per-se with this thread, just dumping some info to maybe influence decisions and hopefully help out / provide some clarity in places :grinning_face:

Excited to see future developments with geo!

3 Likes