diff --git a/scripts/rebuild-overview-tiles.sh b/scripts/rebuild-overview-tiles.sh index 3183d36..ddaa05a 100644 --- a/scripts/rebuild-overview-tiles.sh +++ b/scripts/rebuild-overview-tiles.sh @@ -83,8 +83,8 @@ tippecanoe \ --named-layer=gis_terenuri:terenuri_overview.fgb \ --named-layer=gis_cladiri:cladiri_overview.fgb \ --minimum-zoom=0 \ - --maximum-zoom=16 \ - --base-zoom=16 \ + --maximum-zoom=18 \ + --base-zoom=18 \ --drop-densest-as-needed \ --detect-shared-borders \ --simplification=10 \ diff --git a/src/modules/geoportal/components/map-viewer.tsx b/src/modules/geoportal/components/map-viewer.tsx index 09f8efc..18565b1 100644 --- a/src/modules/geoportal/components/map-viewer.tsx +++ b/src/modules/geoportal/components/map-viewer.tsx @@ -467,13 +467,12 @@ export const MapViewer = forwardRef( // === Terenuri (parcels) === if (usePmtiles) { - // PMTiles serves z13-z16 (pre-generated, instant), Martin only z17-z18 (close detail) - map.addLayer({ id: "l-terenuri-pm-fill", type: "fill", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 13, maxzoom: 17, + // PMTiles serves ALL zoom levels (z13-z18) — zero PostGIS load + map.addLayer({ id: "l-terenuri-pm-fill", type: "fill", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 13, 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: 17, + map.addLayer({ id: "l-terenuri-pm-line", type: "line", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 13, paint: { "line-color": "#15803d", "line-width": 0.8 } }); - // PMTiles labels z16 (cadastral_ref available in PMTiles) - map.addLayer({ id: "l-terenuri-pm-label", type: "symbol", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 16, maxzoom: 17, + map.addLayer({ id: "l-terenuri-pm-label", type: "symbol", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 16, layout: { "text-field": ["coalesce", ["get", "cadastral_ref"], ""], "text-font": ["Noto Sans Regular"], @@ -481,40 +480,43 @@ export const MapViewer = forwardRef( "text-max-width": 8, }, paint: { "text-color": "#166534", "text-halo-color": "#fff", "text-halo-width": 1 } }); + // Martin source kept for selection highlight (no minzoom layer means no tile requests) map.addSource(SOURCES.terenuri, { type: "vector", tiles: [`${m}/${SOURCES.terenuri}/{z}/{x}/{y}`], minzoom: 17, 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: 13, + 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, + paint: { "line-color": "#15803d", "line-width": 0.8 } }); + map.addLayer({ id: LAYER_IDS.terenuriLabel, type: "symbol", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 16, + layout: { + "text-field": ["coalesce", ["get", "cadastral_ref"], ""], + "text-font": ["Noto Sans Regular"], + "text-size": 10, "text-anchor": "center", "text-allow-overlap": false, + "text-max-width": 8, + }, + paint: { "text-color": "#166534", "text-halo-color": "#fff", "text-halo-width": 1 } }); } - map.addLayer({ id: LAYER_IDS.terenuriFill, type: "fill", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: usePmtiles ? 17 : 13, - paint: { "fill-color": "#22c55e", "fill-opacity": 0.15 } }); - map.addLayer({ id: LAYER_IDS.terenuriLine, type: "line", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: usePmtiles ? 17 : 13, - paint: { "line-color": "#15803d", "line-width": 0.8 } }); - map.addLayer({ id: LAYER_IDS.terenuriLabel, type: "symbol", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: usePmtiles ? 17 : 16, - layout: { - "text-field": ["coalesce", ["get", "cadastral_ref"], ""], - "text-font": ["Noto Sans Regular"], - "text-size": 10, "text-anchor": "center", "text-allow-overlap": false, - "text-max-width": 8, - }, - paint: { "text-color": "#166534", "text-halo-color": "#fff", "text-halo-width": 1 } }); // === Cladiri (buildings) === if (usePmtiles) { - // PMTiles serves z14-z16, Martin only z17-z18 - map.addLayer({ id: "l-cladiri-pm-fill", type: "fill", source: "overview-pmtiles", "source-layer": SOURCES.cladiri, minzoom: 14, maxzoom: 17, + // PMTiles serves ALL zoom levels (z14-z18) — zero PostGIS load + map.addLayer({ id: "l-cladiri-pm-fill", type: "fill", source: "overview-pmtiles", "source-layer": SOURCES.cladiri, minzoom: 14, 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: 17, + map.addLayer({ id: "l-cladiri-pm-line", type: "line", source: "overview-pmtiles", "source-layer": SOURCES.cladiri, minzoom: 14, paint: { "line-color": "#1e3a5f", "line-width": 0.6 } }); map.addSource(SOURCES.cladiri, { type: "vector", tiles: [`${m}/${SOURCES.cladiri}/{z}/{x}/{y}`], minzoom: 17, 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: 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, + paint: { "line-color": "#1e3a5f", "line-width": 0.6 } }); } - map.addLayer({ id: LAYER_IDS.cladiriFill, type: "fill", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: usePmtiles ? 17 : 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: usePmtiles ? 17 : 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, + map.addLayer({ id: LAYER_IDS.cladiriLabel, type: "symbol", + source: usePmtiles ? "overview-pmtiles" : SOURCES.cladiri, + "source-layer": SOURCES.cladiri, minzoom: 16, layout: { "text-field": [ "case",