Skip to content

Tile Server

You'll turn raw map data into a map you can pan around in a browser on your own machine, with a style you changed, and watch your own edits show up in it.

About

The map on openstreetmap.org is one style of many, and the data underneath is yours to render. Doing it yourself means a regional extract (Geofabrik, free), an import (osm2pgsql into PostGIS, or Tilemaker into a single vector tile file), a style (OpenStreetMap Carto, or a MapLibre style) and something to serve tiles. Then you change the style, so the map is yours: paths in red for walking, a cycling map, a night map. It's a weekend of installs and a month of understanding what you installed. The cheap route is a city or small-region extract on a laptop with 20 GB free, and the vector tile route skips the database altogether and runs on a Raspberry Pi. Don't import the planet unless you have a terabyte of SSD and a week. The machine itself belongs to Homelab & Hardware; this badge is about the map.

At a glance

Per requirement
50 XP
Completion bonus
600 XP
Requirements
6
Takes
Two months
Skill level
Advanced (years of practice)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
On your own
Locked for now
Earn two more Rare badges in OpenStreetMap to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Download a regional extract and look inside it before you import anything. Geofabrik publishes extracts by country and region; pick the smallest one that contains your town. Run osmium fileinfo on it to see the bounding box, the timestamp and the number of nodes. Take a screenshot of the terminal output. Photo
  2. 2
    Import it, with osm2pgsql into PostGIS or with Tilemaker into a tile file. osm2pgsql with the Carto style wants PostgreSQL, PostGIS and a few GB of RAM for a region; Tilemaker wants a config file and an hour. Note how long it took and how much disk it used, because you'll want to know next time. Take a screenshot of the finished import. Photo
  3. 3
    Serve tiles and pan around your own town in a browser. For raster tiles that's renderd and mod_tile, or a lighter server; for vector tiles it's a static file and a MapLibre page. Point a Leaflet or MapLibre page at it on localhost. Take a screenshot of the browser showing your town from your own server. Photo
  4. 4
    Change the style in at least three visible ways. A colour, a label rule, and a layer added or removed. Footpaths in red, building numbers shown at a lower zoom, the whole thing in dark mode. Take a photo of your map beside the stock style at the same place. Photo
  5. 5
    Make an edit on openstreetmap.org and get it into your own tiles. Either apply the diffs with osm2pgsql-replication or osmium, or re-import a fresh extract the next day. Re-render the affected tiles. Take a screenshot of your edit showing in your own map. Photo
  6. 6
    Open it on a phone and film it panning. Serve it over your home Wi-Fi and open the page on a phone, or export the vector tiles as a PMTiles file and open them in a MapLibre page the same way. Film twenty seconds of panning and zooming around your area, and tell us which install step you'd warn a friend about. Video