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