Skip to content
t-rex is a vector tile server specialized on publishing MVT tiles from your own data
Branch: master
Clone or download
Latest commit 5573769 Dec 21, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update to Rust 2018 edition Dec 9, 2018
t-rex-gdal cargo fmt (Rust 1.31) Dec 9, 2018
t-rex-service cargo fmt (Rust 1.31) Dec 9, 2018
t-rex-webserver cargo fmt (Rust 1.31) Dec 9, 2018
Cargo.lock cargo update Dec 21, 2018
Cargo.toml Update to Rust 2018 edition Dec 9, 2018


Travis build Status Appveyor build status Language (Rust)

t-rex is a vector tile server specialized on publishing MVT tiles from your own data.


  • Support for PostGIS databases and GDAL vector formats
  • Auto-detection of layers in data source
  • Built-in viewers for data display and inspection
  • Tile generation command with simple parallelization
  • Automatic reprojection to grid CRS
  • Support for custom tile grids
  • Embedded styles


  • T-rex, a vector tile server for your own data (FOSS4G 2017): slides
  • Vector Tiles - Introduction & Usage with QGIS (User meeting Bern 21.6.17): slides
  • Von WMS zu WMTS zu Vektor-Tiles (FOSSGIS 2017): Video
  • Workshop "Vector Tiles" (GEOSummit Bern 7.6.16): slides


Quick tour

t_rex serve --dbconn postgresql://user:pass@localhost/osm2vectortiles

Tiles are then served at http://localhost:6767/{layer}/{z}/{x}/{y}.pbf

A list of all detected layers is available at http://localhost:6767/

Use a tile cache:

t_rex serve --dbconn postgresql://user:pass@localhost/osm2vectortiles --cache /tmp/mvtcache

Generate a configuration template:

t_rex genconfig --dbconn postgresql://user:pass@localhost/osm2vectortiles | tee osm2vectortiles.toml

Run server with configuration file:

t_rex serve --config osm2vectortiles.toml

Generate tiles for cache:

t_rex generate --config osm2vectortiles.toml

Increase log level:

t_rex serve --loglevel debug --dbconn postgresql://user:pass@localhost/osm2vectortiles

For developers

t-rex is written in Rust. Minimal required rustc version is 1.31.


cargo build

Run tests:

cargo test --all

Run server with DB connection:

cargo run -- serve --dbconn postgresql://t_rex:t_rex@

Decode a vector tile:

curl --silent | protoc --decode=vector_tile.Tile t-rex-core/src/mvt/vector_tile.proto

Database tests

Unit tests which need a PostgreSQL connection are ignored by default.

Start Test DB:

docker run -p -d --name trextestdb --rm sourcepole/trextestdb

To run the database tests, declare the connection in an environment variable DBCONN:

export DBCONN=postgresql://t_rex:t_rex@

Run the tests with

cargo test --all -- --ignored

Creating test database locally:

# Set Postgresql environment variables when needed: PGHOST, PGPORT, PGUSER, PGPASSWORD
cd data
make createdb loaddata


See Github board


t-rex is released under the MIT License.

You can’t perform that action at this time.