feat(geoportal): PMTiles for terenuri/cladiri overview + cache warming + cleanup

- Extend PMTiles to include simplified terenuri (5m tolerance) and cladiri (3m)
- map-viewer: terenuri z13 from PMTiles, z14+ from Martin (live detail)
- map-viewer: cladiri z14 from PMTiles, z15+ from Martin
- Martin sources start at higher minzoom when PMTiles active (less DB load)
- Add warm-tile-cache.sh: pre-populate nginx cache for major cities
- Rebuild script now includes cache warming step after PMTiles upload
- Remove deprecated docker-compose version: "3.8"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-27 21:46:47 +02:00
parent 236635fbf4
commit 0d5fcf909c
4 changed files with 151 additions and 17 deletions
+30 -11
View File
@@ -328,8 +328,8 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
LAYER_IDS.uatsZ12Fill, LAYER_IDS.uatsZ12Line, LAYER_IDS.uatsZ12Label,
],
administrativ: [LAYER_IDS.adminLineOuter, LAYER_IDS.adminLineInner],
terenuri: [LAYER_IDS.terenuriFill, LAYER_IDS.terenuriLine, LAYER_IDS.terenuriLabel],
cladiri: [LAYER_IDS.cladiriFill, LAYER_IDS.cladiriLine, LAYER_IDS.cladiriLabel],
terenuri: [LAYER_IDS.terenuriFill, LAYER_IDS.terenuriLine, LAYER_IDS.terenuriLabel, "l-terenuri-pm-fill", "l-terenuri-pm-line"],
cladiri: [LAYER_IDS.cladiriFill, LAYER_IDS.cladiriLine, LAYER_IDS.cladiriLabel, "l-cladiri-pm-fill", "l-cladiri-pm-line"],
};
for (const [group, layerIds] of Object.entries(mapping)) {
const visible = vis[group] !== false;
@@ -465,13 +465,23 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
paint: { "line-color": "#f97316", "line-width": 1.5 } });
}
// === Terenuri (parcels) — always from Martin (live data) ===
map.addSource(SOURCES.terenuri, { type: "vector", tiles: [`${m}/${SOURCES.terenuri}/{z}/{x}/{y}`], minzoom: 10, maxzoom: 18 });
map.addLayer({ id: LAYER_IDS.terenuriFill, type: "fill", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 13,
// === Terenuri (parcels) ===
if (usePmtiles) {
// PMTiles overview at z13 (fast, pre-generated), Martin for z14+ (live detail)
map.addLayer({ id: "l-terenuri-pm-fill", type: "fill", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 13, maxzoom: 14,
paint: { "fill-color": "#22c55e", "fill-opacity": 0.15 } });
map.addLayer({ id: "l-terenuri-pm-line", type: "line", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 13, maxzoom: 14,
paint: { "line-color": "#15803d", "line-width": 0.8 } });
// Martin source starts at z14 (saves generating heavy z10-z13 tiles)
map.addSource(SOURCES.terenuri, { type: "vector", tiles: [`${m}/${SOURCES.terenuri}/{z}/{x}/{y}`], minzoom: 14, maxzoom: 18 });
} else {
map.addSource(SOURCES.terenuri, { type: "vector", tiles: [`${m}/${SOURCES.terenuri}/{z}/{x}/{y}`], minzoom: 10, maxzoom: 18 });
}
map.addLayer({ id: LAYER_IDS.terenuriFill, type: "fill", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 14,
paint: { "fill-color": "#22c55e", "fill-opacity": 0.15 } });
map.addLayer({ id: LAYER_IDS.terenuriLine, type: "line", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 13,
map.addLayer({ id: LAYER_IDS.terenuriLine, type: "line", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 14,
paint: { "line-color": "#15803d", "line-width": 0.8 } });
// Parcel cadastral number label
// Parcel cadastral number label (always from Martin — needs live data)
map.addLayer({ id: LAYER_IDS.terenuriLabel, type: "symbol", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 16,
layout: {
"text-field": ["coalesce", ["get", "cadastral_ref"], ""],
@@ -481,11 +491,20 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
},
paint: { "text-color": "#166534", "text-halo-color": "#fff", "text-halo-width": 1 } });
// === Cladiri (buildings) — no simplification ===
map.addSource(SOURCES.cladiri, { type: "vector", tiles: [`${m}/${SOURCES.cladiri}/{z}/{x}/{y}`], minzoom: 12, maxzoom: 18 });
map.addLayer({ id: LAYER_IDS.cladiriFill, type: "fill", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 14,
// === Cladiri (buildings) ===
if (usePmtiles) {
// PMTiles overview at z14 (pre-generated), Martin for z15+ (live detail)
map.addLayer({ id: "l-cladiri-pm-fill", type: "fill", source: "overview-pmtiles", "source-layer": SOURCES.cladiri, minzoom: 14, maxzoom: 15,
paint: { "fill-color": "#3b82f6", "fill-opacity": 0.5 } });
map.addLayer({ id: "l-cladiri-pm-line", type: "line", source: "overview-pmtiles", "source-layer": SOURCES.cladiri, minzoom: 14, maxzoom: 15,
paint: { "line-color": "#1e3a5f", "line-width": 0.6 } });
map.addSource(SOURCES.cladiri, { type: "vector", tiles: [`${m}/${SOURCES.cladiri}/{z}/{x}/{y}`], minzoom: 15, maxzoom: 18 });
} else {
map.addSource(SOURCES.cladiri, { type: "vector", tiles: [`${m}/${SOURCES.cladiri}/{z}/{x}/{y}`], minzoom: 12, maxzoom: 18 });
}
map.addLayer({ id: LAYER_IDS.cladiriFill, type: "fill", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: usePmtiles ? 15 : 14,
paint: { "fill-color": "#3b82f6", "fill-opacity": 0.5 } });
map.addLayer({ id: LAYER_IDS.cladiriLine, type: "line", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 14,
map.addLayer({ id: LAYER_IDS.cladiriLine, type: "line", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: usePmtiles ? 15 : 14,
paint: { "line-color": "#1e3a5f", "line-width": 0.6 } });
// Building body labels — extract suffix after last dash (e.g. "291479-C1" → "C1")
map.addLayer({ id: LAYER_IDS.cladiriLabel, type: "symbol", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 16,