Getting Started

Configuration

How to configure Tileserver RS

Configuration

Tileserver RS uses a TOML configuration file to define tile sources, styles, and server settings.

Configuration File

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"

Server Configuration

OptionDescriptionDefault
hostIP address to bind to0.0.0.0
portPort number8080
cors_originsAllowed CORS origins["*"]

Source Configuration

Each source requires:

OptionDescriptionRequired
idUnique identifierYes
typepmtiles or mbtilesYes
pathPath to tile file (local or URL)Yes
nameDisplay nameNo
attributionMap attributionNo

PMTiles Sources

[[sources]]
id = "world"
type = "pmtiles"
path = "/data/world.pmtiles"
# Or from a URL (requires http feature)
# path = "https://example.com/tiles.pmtiles"

MBTiles Sources

[[sources]]
id = "local-data"
type = "mbtiles"
path = "/data/local.mbtiles"

Style Configuration

[[styles]]
id = "bright"
path = "/data/styles/bright/style.json"

Environment Variables

VariableDescriptionDefault
RUST_LOGLog level (error, warn, info, debug, trace)info
CONFIG_PATHPath to config fileconfig.toml
HOSTOverride server host-
PORTOverride server port-

CLI Options

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