local_mbtiles_server 0.1.0
local_mbtiles_server: ^0.1.0 copied to clipboard
Serve SQLCipher-encrypted and plain MBTiles over localhost HTTP so any map SDK (MapLibre, Mapbox, etc.) can load offline tiles via standard URL templates.
0.1.0 #
Initial release.
Added #
MbtilesSource— open plain or SQLCipher-encrypted MBTiles viasqflite_sqlcipher; passpasswordfor encrypted files (passphrase or raw-keyx'…hex…'form).LocalMbtilesServer— loopback HTTP tile server (127.0.0.1by default) backed byshelf.- Tile serving —
GET /{sourceId}/{z}/{x}/{y}[.{ext}]with web-map XYZ coordinates and TMS row conversion for MBTiles storage. - Supported formats — PNG, JPEG, WebP (raster); PBF/MVT (vector);
Content-Typeand optionalContent-Encoding: gzipset automatically. - Multi-source registry — register, unregister, and serve several MBTiles files from one server.
MbtilesServerHealthandLocalMbtilesServer.health— server status, source count, port, and running state.LocalMbtilesServer.getMetadata(sourceId)— MBTiles metadata by registered source id.- Public API —
MbtilesServerConfig,RouteParser,TileFormat,MbtilesMetadata,TileCoordinates, and typed exceptions. - Example app — encrypted raster MBTiles demo with localhost fetch UI and a MapLibre preview screen (
example/).
Notes #
- Encrypted MBTiles are decrypted on demand per tile request (SQLite page level); the file stays encrypted on disk.
MbtilesSourceresolves tileformatatopen;getMetadata()reads themetadatatable on each call.- HTTP serves tiles only; health and metadata are available via the Dart API (
health,getMetadata). - Requires Android or iOS for real MBTiles I/O (
sqflite_sqlciphernative plugin). - Android apps loading
http://127.0.0.1tiles needandroid:usesCleartextTraffic="true".