Follow-up on Martin Kremers' (@kremers) PMTiles reader, behaviour unchanged
where it was right:
- CAP_MAP_PMTILES (CAP_MICROSD minus the Tanmatsu) gates the reader, the Map
file picker and the zoom limit. The Tanmatsu has a card too, but its AppFS
image has under 1 KB left and this is ~11 KB.
- The directory walk and the gzip inflater move from UITask.cpp into
PmTiles.cpp (checkArchive, gunzip, locateTile over a read callback), so the
whole lookup runs natively. UITask keeps the File glue and the UI.
- Bounded allocations: a directory may hold at most 32768 entries (768 KB
decoded) and only blocks of 16 KB or less fall back to internal RAM, so a
hostile entry count or a big leaf can't take the internal heap Wi-Fi needs.
- Uncompressed directories (internal compression 1) are valid v3 and now
load instead of being listed as "not a PNG raster archive".
- A corrupt directory logs once per archive instead of once per tile.
- The Map file row only shows with Tiles from SD card on, like the zoom row:
picking an archive did nothing with server tiles.
- test/test_pmtiles.cpp now runs from scripts/run-host-tests.sh (it could not
find PmTiles.h there) and checks the full lookup against archives that
test/pmtiles/make_fixtures.py writes from the spec: gzip and plain
directories, leaf directories, runs, unclustered data, gzip header fields;
vector, JPEG, gzip-tile and brotli archives refused; v2, cut short, bad CRC,
lying gzip sizes, hostile counts, out-of-section entries and a leaf that
points at itself all fail cleanly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Offline PNG raster maps can now come from PMTiles v3 archives on the microSD
card, stored as /maps/<name>/<name>.pmtiles, besides the existing z/x/y tile
folders.
- PMTiles reader (PmTiles.h/.cpp): header and directory parsing, tile lookup;
gzip directories are inflated with the ROM tinfl and CRC-checked. Only
uncompressed PNG tiles are accepted. Unit tests in test/test_pmtiles.cpp.
- Map options -> Map file picks the archive or "Folder tiles only"; the choice
is saved by name (map_pmt). Without a saved choice "osm" is used, else the
first archive found. Tiles missing from the archive still load from the
folder layouts and the Wi-Fi fallback.
- Archives that can't be used are listed in the picker with the reason:
file not named after its folder, not PMTiles v3, not a PNG raster archive,
or cut short while copying.
- Map options -> "Zoom: map levels only" (shown only with Tiles from SD card,
saved as map_zfit): the slider range, +/- and every other zoom change stay
on the levels the map holds - the selected archive's header range, or the
numeric z folders of /maps/osm and /tiles for folder tiles. The detected
range is shown next to the toggle.
- Picking an archive moves the zoom into its range if it lies outside.
- README documents the SD layout and both options.