perf(geoportal): extend PMTiles to z18 — eliminate Martin for terenuri/cladiri entirely
PMTiles now covers z0-z18 (full zoom range). Martin sources kept only for selection highlight and fallback when PMTiles not configured. All terenuri/cladiri fill/line/label layers served from PMTiles when active. Zero PostGIS load for tile rendering at any zoom level. File will be ~1-2 GB but eliminates all cold-load latency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,8 +83,8 @@ tippecanoe \
|
|||||||
--named-layer=gis_terenuri:terenuri_overview.fgb \
|
--named-layer=gis_terenuri:terenuri_overview.fgb \
|
||||||
--named-layer=gis_cladiri:cladiri_overview.fgb \
|
--named-layer=gis_cladiri:cladiri_overview.fgb \
|
||||||
--minimum-zoom=0 \
|
--minimum-zoom=0 \
|
||||||
--maximum-zoom=16 \
|
--maximum-zoom=18 \
|
||||||
--base-zoom=16 \
|
--base-zoom=18 \
|
||||||
--drop-densest-as-needed \
|
--drop-densest-as-needed \
|
||||||
--detect-shared-borders \
|
--detect-shared-borders \
|
||||||
--simplification=10 \
|
--simplification=10 \
|
||||||
|
|||||||
@@ -467,13 +467,12 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
|
|||||||
|
|
||||||
// === Terenuri (parcels) ===
|
// === Terenuri (parcels) ===
|
||||||
if (usePmtiles) {
|
if (usePmtiles) {
|
||||||
// PMTiles serves z13-z16 (pre-generated, instant), Martin only z17-z18 (close detail)
|
// 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, maxzoom: 17,
|
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 } });
|
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 } });
|
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,
|
||||||
map.addLayer({ id: "l-terenuri-pm-label", type: "symbol", source: "overview-pmtiles", "source-layer": SOURCES.terenuri, minzoom: 16, maxzoom: 17,
|
|
||||||
layout: {
|
layout: {
|
||||||
"text-field": ["coalesce", ["get", "cadastral_ref"], ""],
|
"text-field": ["coalesce", ["get", "cadastral_ref"], ""],
|
||||||
"text-font": ["Noto Sans Regular"],
|
"text-font": ["Noto Sans Regular"],
|
||||||
@@ -481,40 +480,43 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
|
|||||||
"text-max-width": 8,
|
"text-max-width": 8,
|
||||||
},
|
},
|
||||||
paint: { "text-color": "#166534", "text-halo-color": "#fff", "text-halo-width": 1 } });
|
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 });
|
map.addSource(SOURCES.terenuri, { type: "vector", tiles: [`${m}/${SOURCES.terenuri}/{z}/{x}/{y}`], minzoom: 17, maxzoom: 18 });
|
||||||
} else {
|
} else {
|
||||||
map.addSource(SOURCES.terenuri, { type: "vector", tiles: [`${m}/${SOURCES.terenuri}/{z}/{x}/{y}`], minzoom: 10, maxzoom: 18 });
|
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) ===
|
// === Cladiri (buildings) ===
|
||||||
if (usePmtiles) {
|
if (usePmtiles) {
|
||||||
// PMTiles serves z14-z16, Martin only z17-z18
|
// 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, maxzoom: 17,
|
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 } });
|
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 } });
|
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 });
|
map.addSource(SOURCES.cladiri, { type: "vector", tiles: [`${m}/${SOURCES.cladiri}/{z}/{x}/{y}`], minzoom: 17, maxzoom: 18 });
|
||||||
} else {
|
} else {
|
||||||
map.addSource(SOURCES.cladiri, { type: "vector", tiles: [`${m}/${SOURCES.cladiri}/{z}/{x}/{y}`], minzoom: 12, maxzoom: 18 });
|
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")
|
// 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: {
|
layout: {
|
||||||
"text-field": [
|
"text-field": [
|
||||||
"case",
|
"case",
|
||||||
|
|||||||
Reference in New Issue
Block a user