#maps #tiles #mbtiles #pmtiles #postgis

bin+lib martin

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

8 releases

1.0.0-alpha.0 Oct 18, 2021
0.8.6 Jun 4, 2023
0.8.3 May 22, 2023
0.8.1 Mar 25, 2023
0.6.1 Nov 21, 2022

#9 in Geospatial

Download history 9/week @ 2023-02-13 4/week @ 2023-02-20 1/week @ 2023-02-27 1/week @ 2023-03-13 22/week @ 2023-03-20 8/week @ 2023-03-27 2/week @ 2023-04-03 13/week @ 2023-04-10 5/week @ 2023-04-17 1/week @ 2023-04-24 36/week @ 2023-05-08 2/week @ 2023-05-15 24/week @ 2023-05-22 40/week @ 2023-05-29

102 downloads per month


4.5K SLoC


Book docs.rs docs Slack chat GitHub crates.io version Security audit CI build

Martin is a tile server able to generate and serve vector tiles on the fly from large PostGIS databases, PMTile, and MBTile files, allowing multiple tile sources to be dynamically combined into one. Martin optimizes for speed and heavy traffic, and is written in Rust.

See Martin book for complete documentation.



See installation instructions in the Martin book.

Prerequisites: If using Martin with PostgreSQL database, you must install PostGIS with at least v3.0+, v3.1+ recommended.

You can download martin from GitHub releases page.

Platform Downloads (latest)
Linux 64-bit
macOS 64-bit
Windows 64-bit

If you are using macOS and Homebrew you can install martin using Homebrew tap.

brew tap maplibre/martin https://github.com/maplibre/martin.git
brew install maplibre/martin/martin

Running Martin Service

See running instructions in the Martin book.

Martin supports any number of PostgreSQL/PostGIS database connections with geospatial-enabled tables and tile-producing SQL functions, as well as PMTile and MBTile files as tile sources.

Martin can auto-discover tables and functions using a connection string. A PG connection string can also be passed via the DATABASE_URL environment variable.

Each tile source will have a TileJSON endpoint.


# publish all tables and functions from a single database
export DATABASE_URL=postgresql://user:password@host:port/database

# same as above, but passing connection string via CLI, together with a directory of .mbtiles/.pmtiles files  
martin postgresql://user:password@host:port/database path/to/dir

# publish all discovered tables/funcs from two DBs
# and generate config file with all detected sources
martin postgres://... postgres://...  --save-config config.yaml

# use configuration file instead of auto-discovery
martin --config config.yaml

Docker Example

See Docker instructions in the Martin book.

Martin is also available as a Docker image. You could either share a configuration file from the host with the container via the -v param, or you can let Martin auto-discover all sources e.g. by passing DATABASE_URL or specifying the .mbtiles/.pmtiles files.

export PGPASSWORD=postgres  # secret!
docker run -p 3000:3000 \
           -e PGPASSWORD \
           -e DATABASE_URL=postgresql://user@host:port/db \
           -v /path/to/config/dir:/config \
           ghcr.io/maplibre/martin --config /config/config.yaml


See API documentation in the Martin book.

Martin data is available via the HTTP GET endpoints:

URL Description
/ Status text, that will eventually show web UI
/catalog List of all sources
/{sourceID} Source TileJSON
/{sourceID}/{z}/{x}/{y} Map Tiles
/{source1},...,{sourceN} Composite Source TileJSON
/{source1},...,{sourceN}/{z}/{x}/{y} Composite Source Tiles
/health Martin server health check: returns 200 OK


See Martin book for complete documentation.


~1.5M SLoC