tilemaker README

README проекта с github.com/systemed/tilemaker. Одним файлом markdown: README.md.

tilemaker

tilemaker creates vector tiles (in Mapbox Vector Tile format) from an .osm.pbf planet extract, as typically downloaded from providers like Geofabrik. It aims to be 'stack-free': you need no database and there is only one executable to install.

Vector tiles are used by many in-browser/app renderers, and can also power server-side raster rendering. They enable on-the-fly style changes and greater interactivity, while imposing less of a storage burden. tilemaker can output them to individual files, or to .mbtiles or .pmtiles tile containers.

See an example of a vector tile map produced by tilemaker at tilemaker.org.

Continuous Integration

Getting Started

We provide a ready-to-use docker image that gets you started without having to compile tilemaker from source:

  1. Go to Geofabrik and download the monaco-latest.osm.pbf snapshot of OpenStreetMap
  2. Run tilemaker on the OpenStreetMap snapshot to generate Protomaps vector tiles (see below)
    docker run -it --rm -v $(pwd):/data ghcr.io/systemed/tilemaker:master /data/monaco-latest.osm.pbf --output /data/monaco-latest.pmtiles
  1. Check out what's in the vector tiles e.g. by using the debug viewer here

To run tilemaker with its default configuration

docker run -it --rm --pull always -v $(pwd):/data \
  ghcr.io/systemed/tilemaker:master \
  /data/monaco-latest.osm.pbf \
  --output /data/monaco-latest.pmtiles

To run tilemaker with a custom configuration using coastlines and landcover you have two options

  1. In the config.json use absolute paths such as /data/coastline/water_polygons.shp or
  2. Set the docker workdir -w /data with relative paths coastline/water_polygons.shp (see below)
docker run -it --rm --pull always -v $(pwd):/data -w /data \
  ghcr.io/systemed/tilemaker:master \
  /data/monaco-latest.osm.pbf \
  --output /data/monaco-latest.pmtiles \
  --config /data/config-coastline.json \
  --process /data/process-coastline.lua

Installing

tilemaker is written in C++14. The Makefile builds it as C++14 and the cmake build as C++17; writing MapLibre Tiles (MLT) needs a C++20 compiler. The chief dependencies are:

Other third-party code is bundled in the include/ directory.

You can then simply install with:

make
sudo make install

For detailed installation instructions for your operating system, see INSTALL.md.

Out-of-the-box setup

tilemaker comes with configuration files compatible with the popular OpenMapTiles schema, and a demonstration map server. You'll run tilemaker to make vector tiles from your .osm.pbf source data. To create the tiles, run this from the tilemaker directory:

tilemaker /path/to/your/input.osm.pbf /path/to/your/output.mbtiles

tilemaker keeps everything in RAM by default. To process large areas without running out of memory, tell it to use temporary storage on SSD:

tilemaker /path/to/your/input.osm.pbf /path/to/your/output.mbtiles --store /path/to/your/ssd

Then, to serve your tiles using the demonstration server:

cd server
tilemaker-server /path/to/your/output.mbtiles

You can now navigate to http://localhost:8080/ and see your map!

Coastline and Landcover

To include sea tiles and small-scale landcover, run

./get-coastline.sh
./get-landcover.sh

This will download coastline and landcover data; you will need around 2GB disk space.

Have a look at the coastline and landcover example in the resources/ directory.

Your own configuration

Vector tiles contain (generally thematic) 'layers'. For example, your tiles might contain river, cycleway and railway layers. It's up to you what OSM data goes into each layer. You configure this in tilemaker with two files:

You can read more about these in CONFIGURATION.md.

The JSON configuration and Lua processing files are specified with --config and --process respectively. Defaults are config.json and process.lua in the current directory. If there is no config.json and process.lua in the current directory, and you do not specify --config and --process, an error will result.

Read about tilemaker's runtime options in RUNNING.md.

You might also find these resources helpful:

Why tilemaker?

You might use tilemaker if:

But don't use tilemaker if:

Contributing

Bug reports, suggestions and (especially!) pull requests are very welcome on the Github issue tracker. Please check the tracker to see if your issue is already known, and be nice. For questions, please use IRC (irc.oftc.net or https://irc.osm.org, channel #osm-dev) and https://community.osm.org.

Formatting: braces and indents as shown, hard tabs (4sp). (Yes, I know.) Please be conservative about adding dependencies or increasing the memory requirement.

The Makefile does not currently pick up changes to header files (.h). If you change these, you may need to run make clean before building with make and sudo make install.

tilemaker is maintained by Richard Fairhurst and supported by many contributors. We particularly celebrate the invaluable contributions of Wouter van Kleunen, who passed away in 2022.

Copyright tilemaker contributors, 2015-2025.

The tilemaker code is licensed as FTWPL; you may do anything you like with this code and there is no warranty.

Licenses of third-party libraries:

tilemaker (systemed/tilemaker)

Ищем в базе…

Что это такое?tilemaker — это инструмент командной строки, который превращает выгрузку OpenStreetMap в формате .osm.pbf в векторные тайлы Mapbox (Mapbox Vector Tiles) без необходимости в базе данных.
Это библиотека или самостоятельный инструмент?Это самостоятельный инструмент: вы запускаете один исполняемый файл для входного файла и получаете тайлы на выходе, без необходимости настраивать базу данных или серверный стек.
Как его запустить?Самый быстрый путь — готовый образ Docker. Также можно выполнить make и sudo make install; шаги для конкретной ОС смотрите в INSTALL.md. Затем запустите tilemaker для вашего файла .osm.pbf, чтобы получить .mbtiles.
Что нужно установить заранее?Компилятор с поддержкой C++14, Boost (1.66 или новее), Lua 5.1 или LuaJIT, sqlite3, shapelib и rapidjson. Образ Docker избавляет от всего этого, а для вывода в формате MapLibre Tiles нужен компилятор C++20.
Есть ли подводные камни при работе с большими территориями?По умолчанию tilemaker хранит все данные в оперативной памяти, поэтому для больших территорий укажите ему SSD с помощью --store, чтобы не исчерпать память.
Стоит ли использовать его вместо готовых тайлов из сети?Используйте его, если хотите создавать собственные тайлы без договора со сторонним сервисом. Не подходит, если вы хотите, чтобы тайлы хостил кто-то другой, или нужны постоянные обновления из последних данных OSM.
Можно ли создать тайлы для работы без интернета?Да, в README готовые офлайн-тайлы названы одной из причин выбрать tilemaker.
Его можно использовать бесплатно?Да. Код tilemaker распространяется по лицензии FTWPL, которая позволяет делать с ним что угодно и не даёт никаких гарантий. У включённых сторонних библиотек свои разрешительные лицензии.
Как выглядят выходные файлы и где их можно использовать?Результат записывается либо в отдельные файлы, либо в контейнеры .mbtiles или .pmtiles. Тайлы можно отображать в браузерах и приложениях или на сервере для растровых изображений.
Зачем собирать его самому, а не использовать стек с базой данных?Он стремится быть «без стека»: база данных не нужна, а установить достаточно один исполняемый файл.
Как управлять тем, какие объекты карты попадут в тайлы?Вы пишете JSON-конфигурацию со списком слоёв и уровней масштаба, а также скрипт на Lua, который распределяет объекты OSM по слоям на основе их тегов.
Можно ли просмотреть созданные тайлы?Да. В репозитории есть демонстрационный сервер карт в каталоге server/ (tilemaker-server), который отдаёт ваш выходной файл.
Какие есть похожие проекты?GeoLibre, MapStage, maplibre-gl-js, StreetComplete, mapcn, arnis, kepler.gl, cesium
Автор
systemed
Размер
42.9 MB
Звёзды
1.9K
Возраст
11 г
Коммиты · 90 дней