A no nonsense Vector Tile pipeline
The purpose of Tiler is to create an easy to use, command line orientied pipeline for taking vector data in formats such as Shapefiles, and transforming them into raw Vector Tiles and MBTiles files (if required).
Tiler exists as a Docker container that unifies several technologies to streamline the creation of vector tiles.
Blog Posts
Setup requires installation of Docker and a few Docker commands to get started. We've provided a nice little set of instructions in the SETUP file.
Tiler provides a selection of scripts for converting between various formats and validating them (see the tiler-scripts folder). The primary and simplest way to use Tiler however is to use a config file placed in tiler/tiler-data/configs
. Here is an example config file which references a shapefile and a table in a PostGIS database:
{
"outdir" : "/tiler-data/tiles/",
"tileset" : "states",
"simplification" : 5,
"validate" : false,
"data" : {
"states" : {
"type" : "shapefile",
"databaseInsert" : true,
"paths" : ["/tiler-data/test-data/states/states.shp"],
"minzoom" : 0,
"maxzoom" : 5
},
"capitals" : {
"type" : "postgis",
"query" : "select * from capitals"
"minzoom" : 2,
"maxzoom" : 10
}
}
}
This would be saved as tiler-data/configs/states.tiler.json
. For full documentation of the tiler config, consult the CONFIG file in this repo. The file provides the location of the files you wish to translate, along with the output directory and if you want any simplification to occur. "data" is an object full of layers you wish to be ingested into the tiles. In this case the layer has multiple files that they use to generate that layer ("paths"). You can also provide a minimum zoom ("minzoom") and a maximum zoom ("maxzoom") for each layer.
At the moment "type" can be shapefile
or geojson
, postgis
and gml
.
Once your config file is setup, and you have followed the setup instructions you can run:
./run.sh states
To generate the set of uncompressed vector tiles and an .mbtiles file.
A set of tests are provided that can be run using nosetest.
./run.sh --test
A worked example; we could run the states config file as such:
./run.sh states
After having ran this, there would be a set of states tiles in the tiler/tiler-data/tiles/states
directory. You can then run a web server (i.e. python -m SimpleHTTPServer or live-server) from the host, with the tiler directory as the root. You can then navigate to the demos folder to try out those demo pages.
Demos are provided using Leaflet.VectorGrid and also Mapbox GL for you to display your tiles when you're done. You will need to specify your own styling in these examples.
See our contribution guide here Check out the roadmap here
This project was made possible thanks to building on a fantastic set of previous previous software:
- tippecanoe - Mapbox
- ogr2ogr - OSGeo
- PostGIS Docker Container - Tim Sutton