perf(geoportal): 4-level UAT simplification + intravilan layer + preserve view on basemap switch

UAT zoom-dependent views (read-only, original geom NEVER modified):
- gis_uats_z0 (z0-5): 2000m simplification — country outlines
- gis_uats_z5 (z5-8): 500m — regional overview
- gis_uats_z8 (z8-12): 50m — county/city level with labels
- gis_uats_z12 (z12+): 10m — near-original precision

New layers:
- gis_administrativ (intravilan, arii speciale) — orange dashed, no simplification
- Toggle in layer panel (off by default)

Basemap switching:
- Now preserves current center + zoom when switching between basemaps

Parcels + buildings: NO simplification (exact geometry needed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-23 20:34:15 +02:00
parent 76c19449f3
commit 4f694d4458
4 changed files with 231 additions and 128 deletions
+39 -19
View File
@@ -158,29 +158,49 @@ WHERE geometry IS NOT NULL AND geom IS NULL;
CREATE INDEX IF NOT EXISTS gis_uat_geom_idx
ON "GisUat" USING GIST (geom);
-- 8. Martin/QGIS-friendly view (moderate simplification — 50m tolerance)
CREATE OR REPLACE VIEW gis_uats AS
SELECT
siruta,
name,
county,
ST_SimplifyPreserveTopology(geom, 50) AS geom
FROM "GisUat"
WHERE geom IS NOT NULL;
-- =============================================================================
-- 8. Zoom-dependent views for Martin vector tiles
-- 4 levels of geometry simplification for progressive loading.
-- SAFE: these are read-only views — original geom column is NEVER modified.
-- =============================================================================
-- 9. Simplified view for low zoom levels (z5-z9) — 500m tolerance
CREATE OR REPLACE VIEW gis_uats_simple AS
SELECT
siruta,
name,
-- z0-5: Very coarse overview (2000m tolerance) — country-level outlines
CREATE OR REPLACE VIEW gis_uats_z0 AS
SELECT siruta, name,
ST_SimplifyPreserveTopology(geom, 2000) AS geom
FROM "GisUat" WHERE geom IS NOT NULL;
-- z5-8: Coarse (500m tolerance) — regional overview
CREATE OR REPLACE VIEW gis_uats_z5 AS
SELECT siruta, name,
ST_SimplifyPreserveTopology(geom, 500) AS geom
FROM "GisUat"
WHERE geom IS NOT NULL;
FROM "GisUat" WHERE geom IS NOT NULL;
-- z8-12: Moderate (50m tolerance) — county/city level
CREATE OR REPLACE VIEW gis_uats_z8 AS
SELECT siruta, name, county,
ST_SimplifyPreserveTopology(geom, 50) AS geom
FROM "GisUat" WHERE geom IS NOT NULL;
-- z12+: Fine (10m tolerance) — near-original precision
CREATE OR REPLACE VIEW gis_uats_z12 AS
SELECT siruta, name, county,
ST_SimplifyPreserveTopology(geom, 10) AS geom
FROM "GisUat" WHERE geom IS NOT NULL;
-- Keep the legacy gis_uats view for QGIS compatibility
CREATE OR REPLACE VIEW gis_uats AS
SELECT siruta, name, county,
ST_SimplifyPreserveTopology(geom, 50) AS geom
FROM "GisUat" WHERE geom IS NOT NULL;
-- =============================================================================
-- Done! Martin serves these views as vector tiles:
-- - gis_uats (moderate detail, z9+)
-- - gis_uats_simple (coarse overview, z5-z9)
-- QGIS: PostgreSQL -> 10.10.10.166:5432 / architools_db -> gis_uats view
-- - gis_uats_z0 (z0-5, 2000m simplification)
-- - gis_uats_z5 (z5-8, 500m)
-- - gis_uats_z8 (z8-12, 50m)
-- - gis_uats_z12 (z12+, 10m near-original)
-- - gis_uats (legacy for QGIS, 50m)
-- Original geometry in GisUat.geom is NEVER modified.
-- SRID: 3844 (Stereo70)
-- =============================================================================