Tileserver RS uses a TOML configuration file to define tile sources, styles, and server settings.
Create a config.toml file:
[server]
host = "0.0.0.0"
port = 8080
cors_origins = ["*"]
[[sources]]
id = "openmaptiles"
type = "pmtiles"
path = "/data/tiles.pmtiles"
name = "OpenMapTiles"
attribution = "© OpenMapTiles © OpenStreetMap contributors"
[[sources]]
id = "terrain"
type = "mbtiles"
path = "/data/terrain.mbtiles"
name = "Terrain Data"
[[styles]]
id = "osm-bright"
path = "/data/styles/osm-bright/style.json"
| Option | Description | Default |
|---|---|---|
host | IP address to bind to | 0.0.0.0 |
port | Port number | 8080 |
cors_origins | Allowed CORS origins | ["*"] |
Each source requires:
| Option | Description | Required |
|---|---|---|
id | Unique identifier | Yes |
type | pmtiles or mbtiles | Yes |
path | Path to tile file (local or URL) | Yes |
name | Display name | No |
attribution | Map attribution | No |
[[sources]]
id = "world"
type = "pmtiles"
path = "/data/world.pmtiles"
# Or from a URL (requires http feature)
# path = "https://example.com/tiles.pmtiles"
[[sources]]
id = "local-data"
type = "mbtiles"
path = "/data/local.mbtiles"
[[styles]]
id = "bright"
path = "/data/styles/bright/style.json"
| Variable | Description | Default |
|---|---|---|
RUST_LOG | Log level (error, warn, info, debug, trace) | info |
CONFIG_PATH | Path to config file | config.toml |
HOST | Override server host | - |
PORT | Override server port | - |
tileserver-rs --help
Options:
-c, --config <FILE> Path to configuration file [default: config.toml]
-h, --host <HOST> Override server host
-p, --port <PORT> Override server port
-v, --verbose Enable verbose logging
--help Print help
--version Print version