Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling.
Go to file
Yuri Astrakhan 6b7bcabe49
Cleanup mbtiles, rename TileCopierOptions, testing (#916)
* Rename `TileCopierOptions` -> `TileCopier`
* remove a few un-needed sqlite open to detect mbtiles type
* move `open_and_detect_type` to `MBTiles`
* add `attach_to` to `MBTiles`
* move various table creation fn to mbtiles_queries file
* a few sql format
2023-10-01 23:28:43 -04:00
.cargo-husky/hooks fix pre-push hook script escaping 2023-08-15 15:43:26 -04:00
.github Improve SSL mode testing (#913) 2023-09-30 22:49:56 -04:00
debian Delete trailing spaces (#894) 2023-09-26 15:41:40 +08:00
demo Fix demo (#841) 2023-08-26 09:52:43 -04:00
docs Switch to Rustls (#474) 2023-09-30 17:58:49 +08:00
homebrew-formula Switch to Rustls (#474) 2023-09-30 17:58:49 +08:00
martin version 2023-09-30 23:08:44 -04:00
martin-mbtiles Cleanup mbtiles, rename TileCopierOptions, testing (#916) 2023-10-01 23:28:43 -04:00
martin-tile-utils mbtiles: remove tls features, CI streamlining (#908) 2023-09-29 20:40:32 -04:00
tests Improve SSL mode testing (#913) 2023-09-30 22:49:56 -04:00
.dockerignore Remove docs/book from ignore (unused) 2023-06-22 23:04:57 -04:00
.gitignore add .vscode to gitignroe (#791) 2023-08-02 08:10:01 -04:00
arm64.Dockerfile Switch to Rustls (#474) 2023-09-30 17:58:49 +08:00
Cargo.lock Cleanup mbtiles, rename TileCopierOptions, testing (#916) 2023-10-01 23:28:43 -04:00
Cargo.toml Cleanup mbtiles, rename TileCopierOptions, testing (#916) 2023-10-01 23:28:43 -04:00
CHANGELOG.md Migrate some urbica/martin -> maplibre/martin (#347) 2022-06-11 10:51:41 +03:00
CODE_OF_CONDUCT.md feat: clean up readme and code of conduct (#382) 2022-08-11 07:06:12 -04:00
docker-compose.yml Improve SSL mode testing (#913) 2023-09-30 22:49:56 -04:00
Dockerfile Switch to Rustls (#474) 2023-09-30 17:58:49 +08:00
justfile Improve SSL mode testing (#913) 2023-09-30 22:49:56 -04:00
LICENSE-APACHE Clean up licensing per on-boarding (#364) 2022-07-06 08:25:45 -04:00
LICENSE-MIT Clean up licensing per on-boarding (#364) 2022-07-06 08:25:45 -04:00
logo.png docs: ✏️ add notes on debugging 2019-02-04 20:22:04 +03:00
multi-platform.Dockerfile Use MUSL cross-build for ARM64 & dockers (#909) 2023-09-29 23:11:09 -04:00
README.md Update README.md 2023-10-01 19:55:26 -04:00
rustfmt.toml Minor refactor and cleanup (#716) 2023-06-15 18:36:41 -04:00
SECURITY_POLICY.txt Create SECURITY_POLICY.txt (#489) 2023-02-04 19:06:17 -05:00

Martin

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.

Martin

Installation

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 AMD-64 ARM-64
Linux .tar.gz (gnu), .tar.gz (musl), .deb .tar.gz (musl)
macOS .tar.gz .tar.gz
Windows .zip

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.

Examples

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

# 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

API

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
/sprite/{spriteID}[@2x].{json,png} Sprites (low and high DPI, index/png)
/health Martin server health check: returns 200 OK

Documentation

See Martin book for complete documentation.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.