Convert Figma logo to code with AI

systemed logotilemaker

Make OpenStreetMap vector tiles without the stack

1,653
255
1,653
112

Top Related Projects

An open source visual editor for the 'MapLibre Style Specification'

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

OpenMapTiles Vector Tile Schema Implementation

3,803

Mapnik is an open source toolkit for developing mapping applications

A general-purpose OpenStreetMap mapnik style, in CartoCSS

Build vector tilesets from large collections of GeoJSON features.

Quick Overview

Tilemaker is an open-source tool for creating vector tiles from OpenStreetMap data. It processes OSM .pbf files and generates vector tiles in .mbtiles or individual .pbf files, suitable for use in web mapping applications. Tilemaker is designed to be fast and memory-efficient, making it ideal for processing large datasets.

Pros

  • Fast and memory-efficient processing of OSM data
  • Supports both .mbtiles and individual .pbf tile output formats
  • Highly configurable through JSON and Lua scripting
  • Can be used on desktop or server environments

Cons

  • Requires some technical knowledge to set up and configure
  • Limited documentation for advanced use cases
  • May require significant computational resources for large datasets
  • Dependent on external libraries and tools

Code Examples

  1. Basic usage to create vector tiles:
tilemaker --input planet.osm.pbf --output planet.mbtiles
  1. Using a custom configuration file:
tilemaker --input region.osm.pbf --output region.mbtiles --config config.json
  1. Generating individual .pbf tiles instead of .mbtiles:
tilemaker --input country.osm.pbf --output tiles/ --store pbf

Getting Started

  1. Install dependencies:

    sudo apt-get install build-essential libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev liblua5.1-0-dev libprotobuf-dev libshp-dev libsqlite3-dev protobuf-compiler rapidjson-dev
    
  2. Clone the repository and build:

    git clone https://github.com/systemed/tilemaker.git
    cd tilemaker
    make
    
  3. Run tilemaker with a sample .osm.pbf file:

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

For more detailed configuration and usage instructions, refer to the project's documentation on GitHub.

Competitor Comparisons

An open source visual editor for the 'MapLibre Style Specification'

Pros of Maputnik

  • User-friendly GUI for creating and editing map styles
  • Supports multiple map providers and style formats
  • Allows real-time preview of style changes

Cons of Maputnik

  • Focused on styling rather than data processing
  • Requires pre-existing vector tiles or data sources
  • May have a steeper learning curve for non-designers

Code Comparison

Maputnik (JavaScript):

const style = {
  version: 8,
  sources: {
    osm: {
      type: 'vector',
      url: 'https://example.com/tiles.json'
    }
  },
  layers: [
    // Layer definitions
  ]
};

Tilemaker (C++):

void OutputObject::setGeometryType(GeometryType type) {
    geomType = type;
}

void OutputObject::addAttribute(const string &key, const string &val) {
    attributes[key] = val;
}

Key Differences

  • Maputnik focuses on map styling and design
  • Tilemaker specializes in vector tile creation from OpenStreetMap data
  • Maputnik offers a visual interface, while Tilemaker is command-line based
  • Tilemaker processes raw geographic data, Maputnik works with existing tile sources

Both tools serve different purposes in the mapping workflow, with Tilemaker handling data processing and Maputnik managing the visual presentation of map data.

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

Pros of mapbox-gl-js

  • Comprehensive client-side rendering library for interactive maps
  • Extensive documentation and community support
  • Supports custom styling and advanced visualization features

Cons of mapbox-gl-js

  • Requires a Mapbox account and API key for full functionality
  • Larger file size and potentially higher resource usage
  • Learning curve for complex implementations

Code Comparison

mapbox-gl-js:

mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
const map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v11',
    center: [-74.5, 40],
    zoom: 9
});

tilemaker:

OutputObject outputObject(
    {layer, geomType},
    osmID,
    geom,
    attrMap
);
tileIndex.AddObject(outputObject);

Summary

mapbox-gl-js is a powerful client-side library for rendering interactive maps with extensive features and customization options. It offers a rich ecosystem but requires a Mapbox account and may have a steeper learning curve for complex use cases.

tilemaker, on the other hand, is a server-side tool for generating vector tiles from OpenStreetMap data. It's more focused on tile creation rather than rendering, making it suitable for custom tile generation workflows.

The choice between these tools depends on whether you need client-side rendering capabilities (mapbox-gl-js) or server-side tile generation (tilemaker) for your mapping project.

OpenMapTiles Vector Tile Schema Implementation

Pros of OpenMapTiles

  • More comprehensive and feature-rich, offering a complete vector tile production system
  • Supports multiple data sources beyond OpenStreetMap, including natural earth and water polygons
  • Provides pre-defined map styles and extensive documentation for easier implementation

Cons of OpenMapTiles

  • More complex setup and configuration process
  • Requires more system resources due to its comprehensive nature
  • Steeper learning curve for beginners

Code Comparison

OpenMapTiles:

layers:
  - id: water
    type: polygon
    source: openmaptiles
    source-layer: water
    paint:
      fill-color: '#a0cfdf'

Tilemaker:

function water_polygons(attr, geom)
  local way = {
    kind = "water",
    name = attr.name
  }
  Polygon(geom, way)
end

Both projects aim to create vector tiles from OpenStreetMap data, but they differ in approach and complexity. OpenMapTiles offers a more comprehensive solution with additional features and data sources, while Tilemaker provides a simpler, more lightweight option for basic tile creation. The choice between them depends on the specific requirements of your project and your level of expertise in working with geospatial data.

3,803

Mapnik is an open source toolkit for developing mapping applications

Pros of Mapnik

  • More mature and widely used in production environments
  • Supports a broader range of data sources and input formats
  • Offers advanced cartographic capabilities and styling options

Cons of Mapnik

  • Steeper learning curve and more complex setup
  • Requires more system resources for rendering
  • Less focused on OpenStreetMap data specifically

Code Comparison

Mapnik (C++):

#include <mapnik/map.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/datasource_cache.hpp>

mapnik::Map m(256,256);
mapnik::layer lyr("world");
lyr.set_datasource(mapnik::datasource_cache::instance().create("shape", params));
m.add_layer(lyr);

Tilemaker (C++):

#include "tilemaker.h"

int main(int argc, char* argv[]) {
    TileMaker tm;
    tm.readConfig(configFile);
    tm.readOsmData(inputFile);
    tm.writeTiles(outputFile);
}

Tilemaker is more focused on creating vector tiles from OpenStreetMap data, with a simpler API and workflow. Mapnik offers a more comprehensive toolkit for general-purpose map rendering and styling, but with increased complexity. The choice between the two depends on specific project requirements and the desired level of customization.

A general-purpose OpenStreetMap mapnik style, in CartoCSS

Pros of openstreetmap-carto

  • More comprehensive and detailed styling for OpenStreetMap data
  • Widely used and actively maintained by the OSM community
  • Supports multiple languages and localization

Cons of openstreetmap-carto

  • Steeper learning curve due to complex styling rules
  • Requires more system resources for rendering
  • Limited flexibility for custom map styles

Code Comparison

openstreetmap-carto (CartoCSS):

#landuse {
  [feature = 'leisure_park'] {
    polygon-fill: @park;
    [zoom >= 14] {
      polygon-pattern-file: url('symbols/park.png');
    }
  }
}

tilemaker (Lua):

function landuse_process(feature)
  if feature.leisure == 'park' then
    feature.fill = '#c8facc'
    if zoom >= 14 then
      feature.pattern = 'park.png'
    end
  end
end

Both projects use different approaches for styling map features. openstreetmap-carto uses CartoCSS, a CSS-like language for map styling, while tilemaker employs Lua scripts for processing and styling features. The openstreetmap-carto example shows more complex nested rules, while tilemaker's code is more procedural and straightforward.

Build vector tilesets from large collections of GeoJSON features.

Pros of Tippecanoe

  • Highly optimized for large datasets, capable of handling billions of features
  • Supports advanced tiling strategies like feature dropping and attribute aggregation
  • Offers more granular control over tile generation process

Cons of Tippecanoe

  • Steeper learning curve due to more complex configuration options
  • Limited to GeoJSON input format, less flexible than Tilemaker's OSM support
  • Requires separate steps for styling and serving tiles

Code Comparison

Tilemaker configuration (Lua):

layers = {
  buildings = { minzoom = 14, maxzoom = 17 },
  roads = { minzoom = 11, maxzoom = 17 }
}

Tippecanoe command-line usage:

tippecanoe -o output.mbtiles -Z11 -z17 --drop-densest-as-needed input.geojson

Both tools allow for customization of zoom levels and layer configurations, but Tilemaker uses a Lua-based configuration file, while Tippecanoe relies on command-line arguments for similar functionality.

Tilemaker offers a more integrated approach with OSM data processing and styling capabilities, while Tippecanoe excels in handling large GeoJSON datasets and provides advanced tiling optimizations. The choice between the two depends on specific project requirements, input data format, and desired level of control over the tiling process.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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 chief dependencies are:

  • Boost (latest version advised, 1.66 minimum)
  • Lua (5.1 or later) or LuaJIT
  • sqlite3
  • shapelib
  • rapidjson

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:

  • a JSON file listing each layer, and the zoom levels at which to apply it
  • a Lua program that looks at each node/way's tags, and places it into layers accordingly

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:

  • You want to create vector tiles yourself, without a third-party contract
  • You don't want to host/maintain a database
  • You want a flexible system capable of advanced OSM tag processing
  • You want to create ready-to-go tiles for offline use

But don't use tilemaker if:

  • You want someone else to create and host the tiles for you
  • You want continuous updates with the latest OSM data

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.

Copyright

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-2024.

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: