{"id":15202892,"url":"https://github.com/oklabflensburg/open-map-style","last_synced_at":"2025-10-28T23:31:26.005Z","repository":{"id":223766007,"uuid":"761403333","full_name":"oklabflensburg/open-map-style","owner":"oklabflensburg","description":"German OpenStreetMap CartoCSS stylesheet for the Mapnik pre-processor developed by @oklabflensburg","archived":false,"fork":false,"pushed_at":"2024-10-29T13:22:35.000Z","size":254,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T16:03:28.851Z","etag":null,"topics":["cartocss","mapnik","mss","openstreetmap","osm"],"latest_commit_sha":null,"homepage":"","language":"CartoCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oklabflensburg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T20:01:55.000Z","updated_at":"2024-10-29T13:22:38.000Z","dependencies_parsed_at":"2024-02-22T00:30:29.554Z","dependency_job_id":"98255a60-7a41-436e-bbef-c9c78aa8fd1e","html_url":"https://github.com/oklabflensburg/open-map-style","commit_stats":null,"previous_names":["oklabflensburg/open-map-style"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklabflensburg%2Fopen-map-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklabflensburg%2Fopen-map-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklabflensburg%2Fopen-map-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oklabflensburg%2Fopen-map-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oklabflensburg","download_url":"https://codeload.github.com/oklabflensburg/open-map-style/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238738024,"owners_count":19522297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cartocss","mapnik","mss","openstreetmap","osm"],"created_at":"2024-09-28T04:07:15.382Z","updated_at":"2025-10-28T23:31:25.999Z","avatar_url":"https://github.com/oklabflensburg.png","language":"CartoCSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mapnik OpenStreetMap styles\n\nThis repository collects Mapnik project files, CartoCSS stylesheets, and server\nconfiguration snippets used to render and publish a range of\nOpenStreetMap-derived map styles for the oklab infrastructure. It is intended as\nboth documentation for the existing tile rendering stack and a starting point\nfor local development with tools such as CartoCSS/TileMill and Tirex.\n\nThe repository contains ready-to-render styles, production configuration\nexamples for Tirex, mod_tile, and Apache, and helper datasets required by some\nstyles. Each style can be compiled to Mapnik XML via `carto` and then rendered\nwith Tirex/Mapnik or previewed in TileMill.\n\n---\n\n## Repository layout\n\n| Path | Description |\n| ---- | ----------- |\n| `bksh/`, `bkhh/`, `dgm1tm/`, `fosm/`, `kartierkulisse/`, `knf25/`, `shalkislot/`, `xplan/` | CartoCSS styles with `project.mml` and `style.mss` files that can be compiled with `carto`. Some styles also ship patterns, symbols, or additional project XML exports for Tirex. |\n| `project*.xml` | Mapnik project XML files generated from the CartoCSS sources and used by the tile server (e.g. `project_osm.xml`, `project_knf.xml`). |\n| `mapnik*.conf`, `tirex*.service`, `mod_tile_tirex.conf`, `apache2_renderd.conf`, `tirex.conf`, `mapnik.conf` | Production configuration examples for Tirex backends and Apache/mod_tile integration. |\n| `data/` | Helper datasets used by individual styles (e.g. biotope metadata). |\n| `sh/dgm1/` | Instructions and Mapnik project for importing Schleswig-Holstein DGM1 datasets. |\n| `LICENSE`, `CONTRIBUTING.md` | Legal and contribution guidelines. |\n\n---\n\n## Prerequisites\n\nInstall the system packages required for compiling styles, importing data, and\nrunning Mapnik. The versions below are known to work on current Debian/Ubuntu\nsystems:\n\n```sh\nsudo apt update\nsudo apt install wget curl\nsudo apt install git git-lfs\nsudo apt install python3 python3-pip python3-venv\nsudo apt install postgresql-16 postgresql-postgis gdal-bin osm2pgsql\n\ncurl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh\nsudo -E bash nodesource_setup.sh\nsudo apt install nodejs\nsudo npm install -g carto\n```\n\n---\n\n## Create dedicated system user\n\nRendering happens under the `oklab` user on the production hosts. The commands\nbelow create the account and ensure it has access to the directories used by\nTirex and Apache:\n\n```sh\nsudo adduser oklab\nsudo usermod -a -G www-data oklab\nsudo mkdir -p /opt/oklab\nsudo chown -R oklab:oklab /opt/oklab\nsudo chmod 770 -R /opt/oklab\n```\n\n---\n\n## Configure PostgreSQL/PostGIS\n\nEnable passwordless local connections for the `oklab` user in\n`/etc/postgresql/16/main/pg_hba.conf` and restart PostgreSQL:\n\n```sh\nlocal   oklab           oklab                                   trust\nhost    oklab           oklab           127.0.0.1/32            trust\n```\n\n```sh\nsudo systemctl restart postgresql.service\nsudo systemctl status postgresql.service\n```\n\nCreate the database and enable PostGIS extensions:\n\n```sh\nsudo -i -u postgres\ncreateuser -d oklab\ncreatedb -O oklab oklab\npsql -U oklab\nexit\n```\n\nIf you need superuser access (e.g. to install extensions) connect as Postgres\nand run:\n\n```sh\npsql -U postgres\n\\c oklab\nCREATE EXTENSION IF NOT EXISTS postgis;\nCREATE EXTENSION IF NOT EXISTS hstore;\nALTER TABLE geometry_columns OWNER TO oklab;\nALTER TABLE spatial_ref_sys OWNER TO oklab;\n\\q\n```\n\nWe recommend disabling PostgreSQL JIT for rendering workloads:\n\n```sh\npsql -d oklab -c 'ALTER SYSTEM SET jit=off;'\npsql -d oklab -c 'SELECT pg_reload_conf();'\n```\n\n---\n\n## Obtain data\n\n1. **OpenStreetMap extracts** – Download extracts (e.g. from Geofabrik) as the\n   `oklab` user:\n\n   ```sh\n   sudo -i -u oklab\n   mkdir -p /opt/oklab/map\n   cd /opt/oklab/map\n   wget https://download.geofabrik.de/europe/germany/\u003cgeofabrik-download-filename\u003e\n   ```\n\n2. **Upstream CartoCSS repository** – Clone the upstream\n   [`openstreetmap-carto`](https://github.com/gravitystorm/openstreetmap-carto)\n   repo, which provides helper scripts referenced by several styles:\n\n   ```sh\n   sudo -i -u oklab\n   mkdir -p /opt/oklab/git\n   cd /opt/oklab/git\n   git clone https://github.com/gravitystorm/openstreetmap-carto.git\n   ```\n\n3. **Auxiliary datasets** – Import special datasets as required by specific\n   styles. For example, the DGM1 Schleswig-Holstein workflow is documented in\n   `sh/dgm1/README.md`.\n\n---\n\n## Importing data into PostGIS\n\nFrom the Carto repository, import your extract with osm2pgsql using the flex\nschema:\n\n```sh\nsudo -i -u oklab\ncd /opt/oklab/git/openstreetmap-carto\nosm2pgsql -O flex -S openstreetmap-carto-flex.lua -d oklab /opt/oklab/map/\u003cgeofabrik-download-filename\u003e\n```\n\nPopulate helper tables as needed. The upstream Carto scripts can be used to\ncreate indexes and functions:\n\n```sh\n# From the openstreetmap-carto repository\npsql -d oklab -f indexes.sql\nscripts/indexes.py -0 | xargs -0 -P0 -I{} psql -d oklab -c \"{}\"\npsql -d oklab -f functions.sql\nscripts/get-external-data.py\n```\n\nThe `scripts/` tools referenced above live in the cloned\n`openstreetmap-carto` repository and are not part of this repository.\n\n---\n\n## Fonts\n\nMost styles rely on Google's Noto family as configured in\n`fosm/fonts.mss`. Download fonts with the upstream helper script and add\nadditional fallbacks where necessary:\n\n```sh\n# From openstreetmap-carto\nscripts/get-fonts.sh\n\n# Additional fonts required by the oklab styles\nsudo wget \"https://github.com/googlefonts/noto-emoji/blob/9a5261d871451f9b5183c93483cbd68ed916b1e9/fonts/NotoEmoji-Regular.ttf?raw=true\" \\\n  --content-disposition -P /usr/share/fonts/\nsudo wget \"https://github.com/stamen/terrain-classic/blob/master/fonts/unifont-Medium.ttf?raw=true\" \\\n  --content-disposition -P /usr/share/fonts/\n```\n\n---\n\n## Compiling styles\n\nEach style directory contains a `project.mml` file that can be compiled to\nMapnik XML with `carto`:\n\n```sh\ncd /opt/oklab/git/open-map-style/bksh\ncarto project.mml \u003e ../project_bksh.xml\n```\n\nRepeat the process for the other styles as needed. The generated XML files in\nthis repository (`project_bksh.xml`, `project_osm.xml`, etc.) can be used as\nreferences or checked into version control after regeneration.\n\n---\n\n## Tile server integration\n\nThe repository bundles configuration examples for a Tirex/mod_tile-based tile\nserver setup:\n\n- `tirex.conf`, `tirex-backend-manager.service`, `tirex-master.service` – core\n  Tirex configuration and systemd service definitions.\n- `mapnik.conf`, `mapnik_*.conf` – Renderer definitions for Tirex mapnik\n  backends.\n- `mod_tile_tirex.conf` – Map style configuration blocks consumed by mod_tile,\n  pointing to the generated Mapnik XML files.\n- `apache2_renderd.conf` – Apache virtual host configuration integrating\n  mod_tile and TLS certificates.\n\nInstall these files in `/etc/tirex/` and `/etc/apache2/sites-available/` as\nappropriate for your environment and adjust paths, hostnames, or tile\ndirectories before enabling the services.\n\n---\n\n## TileMill workflow\n\nTo preview or iterate on the styles locally, install TileMill under the `oklab`\nuser:\n\n```sh\ncurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash\nnvm install lts/carbon\nnvm use v8.17.0\n\ncd /opt/oklab/git\ngit clone https://github.com/tilemill-project/tilemill.git\ncd tilemill\nnpm install\nnpm start\n```\n\nUse the PostGIS connection string `dbname=oklab host=127.0.0.1 port=5432\nuser=oklab` and Web Mercator projection `+proj=merc +a=6378137 +b=6378137\n+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null\n+wktext +no_defs +over` inside TileMill when adding layers.\n\n---\n\n## Helper datasets\n\nAdditional SQL and CSV resources required by bespoke styles live in the `data/`\ndirectory. Review these files and load them into PostGIS where necessary before\nrendering specialised layers.\n\nThe `sh/dgm1` directory documents the workflow for importing the Schleswig\nHolstein DGM1 mass download dataset into PostGIS, which is consumed by the\ncorresponding style variant.\n\n---\n\n## How to Contribute\n\nContributions are welcome! Please refer to the\n[CONTRIBUTING.md](CONTRIBUTING.md) guide for details on how to get involved.\n\n---\n\n## License\n\nThis repository is licensed under [CC0-1.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foklabflensburg%2Fopen-map-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foklabflensburg%2Fopen-map-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foklabflensburg%2Fopen-map-style/lists"}