Skip to content

Command-line Interface

You can configure Martin using command-line interface. See martin --help or cargo run -- --help for more information:

Blazing fast and lightweight tile server with PostGIS, MBTiles, and PMTiles support

Usage: martin [OPTIONS] [CONNECTION]...
       martin <COMMAND>

Commands:
  cp    Bulk copy tiles from any Martin-supported sources into an mbtiles file
  help  Print this message or the help of the given subcommand(s)

Arguments:
  [CONNECTION]...
          Connection strings, e.g. postgres://... or /path/to/files

Options:
  -c, --config <CONFIG>
          Path to config file. If set, no tile source-related parameters are allowed

      --save-config <SAVE_CONFIG>
          Save resulting config to a file or use "-" to print to stdout. By default, only print if sources are auto-detected

      --on-invalid <ON_INVALID>
          Action to take when a source is found to be invalid during startup. [DEFAULT: abort]

          Possible values:
          - warn:  Log warning messages, abort if the error is critical
          - abort: Log warnings as errors, abort startup

      --no-tui
          Print the log stream instead of the live dashboard an interactive terminal gets by default

  -s, --sprite <SPRITE>
          Export a directory with SVG files as a sprite source. Can be specified multiple times

  -f, --font <FONT>
          Export a font file or a directory with font files as a font source (recursive). Can be specified multiple times

  -S, --style <STYLE>
          Export a style file or a directory with style files as a style source (recursive). Can be specified multiple times

  -k, --keep-alive <KEEP_ALIVE>
          Connection keep alive timeout. [DEFAULT: 75]

  -l, --listen-addresses <LISTEN_ADDRESSES>
          The socket address to bind. [DEFAULT: 0.0.0.0:3000]

      --route-prefix <ROUTE_PREFIX>
          Set URL path prefix for all API routes.

          When set, Martin will serve all endpoints under this path prefix (e.g., /tiles/health, /tiles/catalog). This allows Martin to be served under a subpath when behind a reverse proxy. Must begin with a /.

          Examples: /tiles, /api/v1/tiles

  -W, --workers <WORKERS>
          Number of web server workers

      --preferred-encoding <PREFERRED_ENCODING>
          Martin server preferred tile encoding. [DEFAULT: gzip]

          If the client accepts multiple compression formats, and the tile source is not pre-compressed, which compression should be used. gzip is faster, but brotli is smaller, and may be faster with caching.

          [possible values: brotli, gzip]

  -u, --webui <WEB_UI>
          Control Martin web UI. [DEFAULT: enable]

          Possible values:
          - disable:        Disable Web UI interface
          - enable:         Enable Web UI interface on connections from the localhost
          - enable-for-all: Enable Web UI interface on all connections

      --tilejson-url-version-param <TILEJSON_URL_VERSION_PARAM>
          If set, the version of the tileset (as specified in the MBTiles or PMTiles metadata) will be embedded in the TileJSON tiles URL, with the set identifier. For example, if the value of this option is version, and the tileset version is 1.0.0,
          the TileJSON tiles URL will be like .../{z}/{x}/{y}?version=1.0.0

  -C, --cache-size <CACHE_SIZE>
          Main cache size (in MB)

      --cache-expiry <CACHE_EXPIRY>
          Maximum lifetime for cache entries (e.g. "1h", "30m", "1d")

      --cache-idle-timeout <CACHE_IDLE_TIMEOUT>
          Maximum idle time before cache entries are evicted (e.g. "15m", "1h")

  -b, --auto-bounds <AUTO_BOUNDS>
          Specify how bounds should be computed for the spatial PG tables. [DEFAULT: quick]

          Possible values:
          - quick: Compute table geometry bounds, but abort if it takes longer than 5 seconds
          - calc:  Compute table geometry bounds. The startup time may be significant. Make sure all GEO columns have indexes
          - skip:  Skip bounds calculation. The bounds will be set to the whole world

      --ca-root-file <CA_ROOT_FILE>
          Loads trusted root certificates from a file. The file should contain a sequence of PEM-formatted CA certificates

  -d, --default-srid <DEFAULT_SRID>
          If a spatial PG table has SRID 0, then this default SRID will be used as a fallback

  -p, --pool-size <POOL_SIZE>
          Maximum Postgres connections pool size [DEFAULT: 20]

      --pg-retry-timeout <PG_RETRY_TIMEOUT>
          How long the first PostgreSQL connection is retried before startup fails, a duration like 30s or infinite. [DEFAULT: 30s]

  -m, --max-feature-count <MAX_FEATURE_COUNT>
          Limit the number of geo features per tile.

          If the source table has more features than set here, they will not be included in the tile and the result will look "cut off"/incomplete. This feature allows to put a maximum latency bound on tiles with extreme amount of detail at the cost
          of not returning all data. It is sensible to set this limit if you have user generated/untrusted geodata, e.g. a lot of data points at Null Island.

          Can be either a positive integer or unlimited if omitted.

      --ssl-cert <SSL_CERT>
          A file with a client SSL certificate

      --ssl-key <SSL_KEY>
          A file with the key for the client SSL certificate

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Use RUST_LOG environment variable to control logging level, e.g. RUST_LOG=debug or RUST_LOG=martin=debug.
Use RUST_LOG_FORMAT environment variable to control output format: json, full, compact (default), bare or pretty.
See https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html for more information.

Terminal dashboard

Started from an interactive terminal, Martin turns it into a live view of the server. It lists the sources with how often each was asked for and how long that took, plots the last minute of tile requests on a world map, charts the request rate, and keeps the log in a pane at the bottom. Press q to stop the server and c to reset the counters. The log pane writes its lines in the format RUST_LOG_FORMAT selects, pretty by default. martin --no-tui prints the log stream instead, which is also what a service, a container or a pipe gets, as the dashboard needs a terminal to draw on.