Package: tilekiln
TilekilnBackgroundTilekiln is a set of command-line utilities to generate and serve Mapbox Vector Tiles (MVTs).Generation relies on the standard method of a PostgreSQL + PostGIS server as a data source, and ST_AsMVT to serialize the MVTs.The target use-case is vector tiles for OpenStreetMap Carto on openstreetmap.org, a worldwide complex basemap under high load.Minutely updates are supported with an appropriately updating database.RequirementsTilekiln requires a PostGIS database with data loaded to generate vector tiles.OpenStreetMap Carto'sdirections are a good starting place for loading OpenStreetMap data into a PostGIS database, but any PostGIS data source in EPSG 3857 will work.PostgreSQL 10+PostGIS 3.1+Python 3.10+UsageTilekiln commands can be broken into two sets, commands which involve serving tiles, and CLI commands. Command-line options can be found with--help.CLI commandsThese commands will do something, then exit.configCommands to work with and check config filesgenerateCommands for tile generationsqlPrints the SQL for a tilestorageCommands working with tile storageServing commandsThese commands start a HTTP server to serve content.devStarts a server to live-render tiles with no caching, intended for development. It presents a tilejson at/<id>/tilejson.json, and for convience/tilejson.jsonredirects to it.liveLikeserve, but fall back to live generation if a tile is missing from storage.It presents a tilejson at/<id>/tilejson.json.serveServes tiles from tile storage. This is highly scalable and the preferred mode for production.It presents a tilejson at/<id>/tilejson.json. In the future it will allow serving multiple tilesets.Quick-startThese instructions give you a setup based on osm2pgsql-themepark and their shortbread setup. They assume you have PostgreSQL with PostGIS and Python 3.10+ with venv set up, and a recent version of osm2pgsql.Install and setupgitclonehttps://github.com/osm2pgsql-dev/osm2pgsql-themepark.git
python3-mvenvtilekiln
tilekiln/bin/pipinstalltilekiln
createdbflex
psql-dflex-c'CREATE EXTENSION postgis;'createdbtilesLoading dataWe have to produce a tilekiln config from the osm2pgsql-themepark config. This requires uncommenting a line in the config.sed-i-E-e"s/--.*(themepark:plugin\('tilekiln'\):write_config\('tk'\))/\1/"./osm2pgsql-themepark/config/shortbread_gen.luaLUA_PATH="./osm2pgsql-themepark/lua/?.lua;;"osm2pgsql-dflex-Oflex-S./osm2pgsql-themepark/config/shortbread_gen.luaosm-data.pbf--cache7000LUA_PATH="./osm2pgsql-themepark/lua/?.lua;;"osm2pgsql-gen-dflex-S./osm2pgsql-themepark/config/shortbread_gen.lua-j8mkdir-pdownloads
osm2pgsql-themepark/themes/external/download-and-import.sh./downloadsflexoceansoceanServe some tilestilekiln/bin/tilekilndevUse the tilejson URLhttp://127.0.0.1:8000/tilejson.jsonto load tiles into your preferred tile viewer such as QGIS.HistoryThe tilekiln configuration syntax is based on studies and experience with other vector tile and map generation configurations. In particular, it is heavily inspired by Tilezen's use of Jinja2 templates and TileJSON for necessary metadata.LicenseCodeCopyright © 2022-2024 Paul Normanosm@paulnorman.caThe code is licensed terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program. If not, seehttp://www.gnu.org/licenses/.DocumentationThe text of the documentation and configuration format specification is licensed under aCreative Commons Attribution 4.0 International License. However, the use of the specification in products and code is entirely free: there are no royalties, restrictions, or requirements.Sample configurationThe sample configuration files are released under the CC0 Public
Domain Dedication, version 1.0, as published by Creative Commons.
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to the Software to
the public domain worldwide. The Software is distributed WITHOUT
ANY WARRANTY.If you did not receive a copy of the CC0 Public Domain Dedication
along with the Software, seehttp://creativecommons.org/publicdomain/zero/1.0/