Files
homepage/tile-proxy/deploy/tile-proxy.service
T
Alexander 2347a02fcb feat(hikes): worldwide maps via a region-switching tile proxy
Add tile-proxy/: a small Rust (axum) service behind nginx that serves one
canonical XYZ scheme (/{karte,luftbild,dufour}/{z}/{x}/{y}) and, per tile,
picks the provider by geometry — swisstopo when the tile overlaps a
swisstopo-covered region (Switzerland or Liechtenstein, each simplified +
2 km buffer; tile-bbox ∩ polygon at every zoom), otherwise OpenTopoMap
(schematic) / Esri World Imagery (satellite), with an auto-fallback for
border 404s. Includes the region generator (gen-regions.mjs), a Makefile,
nginx caching-proxy + systemd examples, and a README. Listen address is
env-driven (TILE_PROXY_ADDR).

App side:
- New mapTiles.ts is the single source for the proxy URLs + combined
  attribution; HikeMap / HikesOverviewMap / EditMap fetch through
  maps.bocken.org instead of swisstopo directly, on-map attribution
  controls removed, preconnect + footer credits updated (swisstopo /
  OpenStreetMap+OpenTopoMap / Esri).
- Region-aware schematic max zoom (isSwissRegion helper): detail map caps
  at z17 abroad and hides the CH/LI-only Dufour layer; overview caps at
  z18 when a shown hike is abroad.
- Route-builder: add the satellite layer via the same bottom-right layer
  popover as the other maps.
2026-05-22 16:26:22 +02:00

30 lines
839 B
Desktop File

# systemd unit for the tile proxy.
# install: cp deploy/tile-proxy.service /etc/systemd/system/
# (build first: cargo build --release; adjust paths/user below)
# enable: systemctl daemon-reload && systemctl enable --now tile-proxy
[Unit]
Description=Region-switching map tile proxy (swisstopo / world)
After=network-online.target
Wants=network-online.target
[Service]
# The one place the port is configured — nginx must point at the same value.
Environment=TILE_PROXY_ADDR=127.0.0.1:8765
ExecStart=/opt/tile-proxy/tile-proxy
Restart=on-failure
RestartSec=2
# Hardening — the service only needs outbound network.
DynamicUser=yes
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_INET AF_INET6
MemoryMax=128M
[Install]
WantedBy=multi-user.target