fix(geoportal): proxy PMTiles through HTTPS + fix click/selection + optimize rebuild

PMTiles was loaded via HTTP from MinIO (10.10.10.166:9002) on an HTTPS page,
causing browser mixed-content blocking — parcels invisible on geoportal.

Fixes:
- tile-cache nginx proxies /pmtiles/ → MinIO with Range header support
- PMTILES_URL changed to relative path (resolves to HTTPS automatically)
- clickableLayers includes PMTiles fill layers (click on parcels works)
- Selection highlight uses PMTiles source at z13+ (was Martin z17+ only)
- tippecanoe per-layer zoom ranges (terenuri z13-z18, cladiri z14-z18)
  skips processing millions of features at z0-z12 — faster rebuild

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-29 14:56:49 +03:00
parent b46eb7a70f
commit 9bf79a15ed
4 changed files with 54 additions and 15 deletions
@@ -480,7 +480,8 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
"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)
// Martin source registered but unused (selection uses PMTiles source now)
// Kept as fallback reference — no tile requests since no layers target it
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 });
@@ -539,10 +540,12 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
paint: { "text-color": "#1e3a5f", "text-halo-color": "#fff", "text-halo-width": 1 } });
// === Selection highlight ===
map.addLayer({ id: LAYER_IDS.selectionFill, type: "fill", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 13,
// Use PMTiles source when available (has data at z13+), Martin only has z17+
const selectionSrc = usePmtiles ? "overview-pmtiles" : SOURCES.terenuri;
map.addLayer({ id: LAYER_IDS.selectionFill, type: "fill", source: selectionSrc, "source-layer": SOURCES.terenuri, minzoom: 13,
filter: ["==", "object_id", "__NONE__"],
paint: { "fill-color": "#f59e0b", "fill-opacity": 0.5 } });
map.addLayer({ id: LAYER_IDS.selectionLine, type: "line", source: SOURCES.terenuri, "source-layer": SOURCES.terenuri, minzoom: 13,
map.addLayer({ id: LAYER_IDS.selectionLine, type: "line", source: selectionSrc, "source-layer": SOURCES.terenuri, minzoom: 13,
filter: ["==", "object_id", "__NONE__"],
paint: { "line-color": "#d97706", "line-width": 2.5 } });
@@ -571,8 +574,10 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
});
/* ---- Click handler — NO popup, only callback ---- */
// Include both Martin and PMTiles fill layers — filter() skips non-existent ones
const clickableLayers = [
LAYER_IDS.terenuriFill, LAYER_IDS.cladiriFill,
"l-terenuri-pm-fill", "l-cladiri-pm-fill",
];
map.on("click", (e) => {