From d09d953cbfb8cbb6261f8aa9cc6ff984abec9864 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Fri, 11 Sep 2026 23:28:07 +0200 Subject: [PATCH] Pass --download to Planetiler for its auxiliary OpenMapTiles sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real build failure once the tmp-filename fix got past the format- detection error: "data/sources/lake_centerline.shp.zip does not exist. Run with --download to fetch it". The OpenMapTiles profile needs a few small non-OSM sources (water polygons, Natural Earth, lake centerlines) alongside the .osm.pbf itself, and Planetiler only fetches them when told to. They land under its own default data/sources/, gitignored alongside the rest of data/ — fetched once, reused by every later build. --- .gitignore | 7 +++++++ lib/maptool/pmtiles_builder.rb | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3a672cb..c693edd 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,13 @@ # also local-only — see PmtilesBuilder.cached_extract) /data/geofabrik_cache/ +# Planetiler's own auxiliary-source cache and scratch working directory +# (water polygons/Natural Earth/lake centerlines, --download; temp feature +# DBs, --tmpdir) — relative to the app's CWD, which lands them here +# alongside the rest of data/ (see extract_offline's --download comment) +/data/sources/ +/data/tmp/ + # Offline Wikipedia ZIM for kiwix-serve (also large, also local-only — # same story, see docs/development.adoc) /data/kiwix/* diff --git a/lib/maptool/pmtiles_builder.rb b/lib/maptool/pmtiles_builder.rb index a403683..a4844fa 100644 --- a/lib/maptool/pmtiles_builder.rb +++ b/lib/maptool/pmtiles_builder.rb @@ -268,7 +268,15 @@ module Maptool # suffix made it fail with "Unsupported format tmp" instead of # actually tiling anything. tmp_path = File.join(data_dir, "offline.tmp.pmtiles") - run_planetiler!("--osm-path=#{osm_path}", "--output=#{tmp_path}") + # --download: the OpenMapTiles profile also needs a few small auxiliary + # sources (water polygons, Natural Earth, lake centerlines) alongside + # the OSM extract itself — without this flag Planetiler expects them + # to already exist on disk and fails instead of fetching them. They + # land under Planetiler's own default "data/sources/", relative to + # this process's working directory (the app root, so in practice + # that's data_dir's own "sources" subdirectory) — fetched once, + # reused by every later build. + run_planetiler!("--osm-path=#{osm_path}", "--output=#{tmp_path}", "--download") File.rename(tmp_path, File.join(data_dir, "offline.pmtiles")) File.write(offline_meta_path(data_dir), JSON.generate(sources: sources.map { |s| s.slice("code", "slug", "last_modified") })) ensure