t-rex Quickstart

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

This Quick Start describes how to:

  • generate vector tiles without configuration and inspect them with built-in viewers
  • generate a tile cache

Start t-rex

  1. Choose Geospatial ‣ Web Services ‣ T-Rex from menu
  2. t-rex is started in zero-config mode connecting to PostGIS database osm_local
  3. A browser window is opened showing the t-rex backend:

Built-in viewers

t-rex comes with built-in viewers for inspecting generated vector tiles.

  1. Open the t-rex backend on
  2. Click on th X-Ray entry in the upper right menu, to open the x-ray viewer.
  3. Hover the mouse on a line to inspect the content of a feature.

Try also the other viewers. Remark: The Mapbox GL viewer and and Maputnik require WebGL support, which is probably not available when running OSGeoLive in a VM.

Cache seeding

  1. Close the browser and the terminal window running t-rex.
  2. Open any text editor (e.g. Accessories ‣ Leafpad).
  3. Create the file “ne.toml” in your home directory: /home/user/ne.toml

Put the following content in it:

viewer = true

dbconn = "postgresql://user:user@localhost/natural_earth2"
name = "dbconn"
default = true

predefined = "web_mercator"

name = "ne_countries"
extent = [-180.00000, -90.00000, 180.00000, 83.63410]
minzoom = 0
maxzoom = 6

name = "country"
geometry_field = "the_geom"
geometry_type = "MULTIPOLYGON"
srid = 4326
buffer_size = 3
#make_valid = true
simplify = false
sql = """SELECT the_geom, adm0_a3, mapcolor7 FROM ne_10m_admin_0_countries WHERE the_geom && !bbox!"""

base = "/home/user/mvtcache"
baseurl = "http://example.com/tiles"

# Bind address. Use to listen on all adresses.
bind = ""
port = 6767

path = "/static"
dir = "./static/"

Open a terminal (System Tools ‣ LXTerminal) and type:

t_rex generate --config ne.toml --maxzoom 4 2>/dev/null

To inspect the generated tiles type:

find mvtcache

What Next?

To create your own map viewer you can use the snippets on the info page in the t-rex backend.

After that you can use the built-in Maputnik editor (also linked from the info page) to create your own Mapbox GL Json style.