Skip to content

Generate Vector Tiles from a PostgreSQL database in Rust

License

Notifications You must be signed in to change notification settings

amandasaurus/tileigi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tileigi: Let us Tile!

tileigi[1] generates vector tiles from a PostgreSQL/PostGIS database. It’s goals are to be as fast as possible, and as easy to install as possible.

The input format is the .tm2source YAML file format, documented here.

Installation

Install rust & download/clone this repository, and then build it.

cargo build --release

release mode is much faster than the default debug mode.

The binary will be in ./target/release/tileigi. The binary file should be self contained and have no extra dependencies. During this early development phase, debug symbols are on for release mode builds, so the file can be large. Reduce it’s size with strip ./target/release/tileigi

Example usage

Sample command:

tileigi --data-yml ./myfile-data.yml  --dest-mbtiles ./mytiles.mbtiles

Options

tileigi 0.8.0
Generate vector tiles from a yml file

USAGE:
    tileigi [FLAGS] [OPTIONS] --data-yml <FILENAME> <--dest-dir <DIR>|--dest-mbtiles <FILENAME>|--dest-modtile <DIR>>

FLAGS:
    -h, --help             Prints help information
        --if-not-exists    Do not generate a tile if the file already exists. Doesn't work with mbtiles (yet)
        --no-compress      Do not compress the pbf files
    -V, --version          Prints version information

OPTIONS:
        --bbox <MINLON,MINLAT,MAXLON,MAXLAT>    Only generate tiles inside this bbox. 'planet' for planet, or minlon,minlat,maxlon,maxlat
        --bbox-bottom <DEGREES>                 BBox, bottom
        --bbox-left <DEGREES>                   BBox, left
        --bbox-right <DEGREES>                  BBox, right
        --bbox-top <DEGREES>                    BBox, top
        --data-yml <FILENAME>                   Filename of the .yml file
        --dest-dir <DIR>                        Save tiles to this mbtiles file
        --dest-mbtiles <FILENAME>               Save tiles to this TileStash directory path
        --dest-modtile <DIR>                    Save tiles to this mod_tile directory path
        --mode <iter_mode>                       [default: tile-then-layer]  [possible values: tile-then-layer, layer
                                                -then-tile]
        --maxzoom <ZOOM>                        Maximum zoom to generate [default: 14]
        --metatile-scale <NUMBER>               Size of metatile to use (8x8 default) [default: 8]
        --minzoom <ZOOM>                        Minimum zoom to generate [default: 0]
        --threads <NUBMER>                      Number of concurrent generation threads to run [default: 1]
        --tile-list <FILENAME>                  Generate tiles from a list of tiles, one metatile per line 'SCALE Z/X/Y'
        --zoom <ZOOM>                           Only generate for this zoom

It is still in early days, and beta qualtiy.

Future work & Bugs

  • Always generate valid polygons (mostly done)

  • Refactor file storage to allow access to MBTiles in threads to support --if-not-exists

  • Memory leak, memory usage grows when generating a lot of tiles (queue size)

  • Refactor to make it cleanier, less messy.

  • Bolt a HTTP server to the front to dynamically serve tiles

  • Faster, always making it faster

  • Document the Metatile file format

Copyright GNU Affero GPL v3 (or later). See the file LICENCE


1. In Irish, -igí suffix is used for the plural imperitive. "tile" in Irish means plank of a boat, if we conjucate the English verb "to tile", we get "tileigi" or "let us tile"