MBTiles File Sources
Martin can serve any type of tiles from MBTile files.
MBTiles archives are local SQLite databases and must reside on the same machine as the tile server.
To serve a file from CLI, simply put the path to the file or the directory with *.mbtiles files.
For example:
You may also want to generate a config file using the --save-config my-config.yaml, and later edit
it and use it with --config my-config.yaml option.
Tip
See MBTiles vs PMTiles for a comparison of the two file formats.
MBTiles Hot Reload
Martin watches directories configured under mbtiles for changes at runtime.
When .mbtiles files are added, modified, or removed from a watched directory, Martin automatically updates the tile catalog - no restart required.
# Martin will watch this directory and reflect any *.mbtiles changes live
martin /path/to/mbtiles/directory
Or via config file:
Scanning subdirectories
Set recursive: true next to paths to scan subdirectories too.
A nested file is named by its path relative to the scanned directory with / replaced by ., so 2024/roads.mbtiles becomes 2024.roads.
Per-project directories
List a directory of project directories under collections to publish every file inside a project as <project>.<file>, so /projects/tiles/project1/roads.mbtiles becomes project1.roads.
The following events are handled automatically:
- File added - the new source appears in the catalog.
- File modified - the source is reloaded and its tile cache is invalidated.
Not available on windows due to OS-limitations (SQLite not allowing
FILE_SHARE_DELETE). - File removed - the source is removed from the catalog.
Note
Hot reload applies to directories configured under mbtiles.paths (or passed on the CLI). Named sources listed under mbtiles.sources are snapshotted at startup and are not watched for changes.