diff --git a/app/script/check_dynamic_layers.py b/app/script/check_dynamic_layers.py
deleted file mode 100644
index 9d234ad..0000000
--- a/app/script/check_dynamic_layers.py
+++ /dev/null
@@ -1,72 +0,0 @@
-"""
-批量检查所有 rainfall 模板的图层,看哪些动态图层需要显示、表是否存在
-"""
-import zipfile, re, os, psycopg2
-
-TEMPLATE_DIR = r"F:\project\xian\xian_algorithm_new\app\data\template\rainfall"
-
-# 收集所有非GPKG动态图层的表名
-all_dynamic = set()
-for fname in sorted(os.listdir(TEMPLATE_DIR)):
- if not fname.endswith('.qgz') or fname.startswith('tmp'):
- continue
- path = os.path.join(TEMPLATE_DIR, fname)
- z = zipfile.ZipFile(path)
- qgs_name = [n for n in z.namelist() if n.endswith('.qgs')][0]
- content = z.read(qgs_name).decode('utf-8')
-
- maplayer_re = re.compile(r']*>(.*?)', re.DOTALL)
- for m in maplayer_re.finditer(content):
- block = m.group(1)
- name_m = re.search(r'([^<]+)', block)
- provider_m = re.search(r']*>(\w+)', block)
- ds_m = re.search(r'(.*?)', block, re.DOTALL)
-
- provider = provider_m.group(1) if provider_m else '?'
- if provider != 'postgres':
- continue
-
- ds = ds_m.group(1).strip() if ds_m else ''
- table_m = re.search(r'table="(\w+)"\."(\w+)"', ds)
- layer_name = name_m.group(1) if name_m else '?'
-
- if table_m:
- schema = table_m.group(1)
- table = table_m.group(2)
- key = f"{schema}.{table}"
- all_dynamic.add((layer_name, key))
-
-# 已知的GPKG静态层(会被替换为ogr)
-static_tables = {
- 'base.rivers', 'base.river', 'base.sx', 'base.sx_capital',
- 'base.sx_street', 'base.sx_xa_county', 'base.sx_xa_county_boundary',
- 'base.sx_zb_county_boundary', 'base.sx_zb_city', 'base.sx_zb_county',
- 'base.active_fault', 'base.traffic_expressway', 'base.traffic_provincial',
- 'base.traffic_railway', 'base.traffic_township', 'base.traffic_trunk_line',
-}
-
-# DB检查
-c = psycopg2.connect(host='47.92.216.173', port=7654, user='postgres', password='zhangsan', database='xian_new')
-c.autocommit = True
-cur = c.cursor()
-
-print(f"{'图层名':20s} {'原表':35s} {'qgis中存在':12s} {'行数':>8s}")
-print("-" * 80)
-
-for layer_name, table_key in sorted(all_dynamic):
- if table_key in static_tables:
- continue # 会被GPKG替换,跳过
-
- schema, table = table_key.split('.', 1)
- try:
- cur.execute(f'SELECT count(*) FROM qgis.{table}')
- count = cur.fetchone()[0]
- exists = "YES"
- except:
- exists = "NO"
- count = 0
-
- marker = " !!!" if exists == "NO" else ""
- print(f"{layer_name:20s} {table_key:35s} {exists:12s} {count:>8,d}{marker}")
-
-c.close()
diff --git a/app/script/check_layer_order.py b/app/script/check_layer_order.py
deleted file mode 100644
index 8cf061b..0000000
--- a/app/script/check_layer_order.py
+++ /dev/null
@@ -1,54 +0,0 @@
-"""检查模板中所有图层的渲染顺序(z-order)"""
-import zipfile, re, os
-
-TEMPLATE_DIR = r"F:\project\xian\xian_algorithm_new\app\data\template\rainfall"
-fname = "暴雨内涝潜在隐患点及人口分布图.qgz"
-path = os.path.join(TEMPLATE_DIR, fname)
-
-z = zipfile.ZipFile(path)
-qgs_name = [n for n in z.namelist() if n.endswith('.qgs')][0]
-content = z.read(qgs_name).decode('utf-8')
-
-# 提取所有 maplayer 块(保持顺序 — 这就是渲染顺序)
-maplayer_re = re.compile(r']*>(.*?)', re.DOTALL)
-
-print(f"模板: {fname}")
-print(f"{'#':>3s} {'图层名':20s} {'类型':10s} {'可见':4s} {'表名'}")
-print("-" * 80)
-
-for i, m in enumerate(maplayer_re.finditer(content)):
- block = m.group(1)
-
- # 图层名
- name_m = re.search(r'([^<]+)', block)
- name = name_m.group(1) if name_m else '?'
-
- # provider
- provider_m = re.search(r']*>(\w+)', block)
- provider = provider_m.group(1) if provider_m else '?'
-
- # datasource table
- ds_m = re.search(r'(.*?)', block, re.DOTALL)
- ds = ds_m.group(1).strip() if ds_m else ''
- table_m = re.search(r'table="(\w+)"\."(\w+)"', ds)
- table = f"{table_m.group(1)}.{table_m.group(2)}" if table_m else '?'
-
- # 可见性
- visible = 'Y' if 'visible="1"' in m.group(0) or 'visible="1"' in block else 'N'
-
- # 判断图层类型
- is_static = table in [
- 'base.rivers', 'base.river', 'base.sx', 'base.sx_capital',
- 'base.sx_street', 'base.sx_xa_county', 'base.sx_xa_county_boundary',
- 'base.sx_zb_county_boundary', 'base.sx_zb_city', 'base.sx_zb_county',
- 'base.active_fault', 'base.traffic_expressway', 'base.traffic_provincial',
- 'base.traffic_railway', 'base.traffic_township', 'base.traffic_trunk_line',
- ]
- layer_type = "底图" if is_static else "动态"
-
- marker = " <<<" if not is_static and provider == 'postgres' else ""
- print(f"{i+1:>3d} {name:20s} {provider:10s} {visible:4s} {table:35s} [{layer_type}]{marker}")
-
-print()
-print("提示: 图层按从上到下的顺序渲染(序号小的在底层,序号大的在顶层)")
-print("动态图层如果在底图下方,会被底图完全遮盖")
diff --git a/app/script/check_layout.py b/app/script/check_layout.py
deleted file mode 100644
index b480b4a..0000000
--- a/app/script/check_layout.py
+++ /dev/null
@@ -1,65 +0,0 @@
-"""检查布局 Map 项的图层配置"""
-import zipfile, re, os
-
-TEMPLATE_DIR = r"F:\project\xian\xian_algorithm_new\app\data\template\rainfall"
-fname = "暴雨内涝潜在隐患点及人口分布图.qgz"
-path = os.path.join(TEMPLATE_DIR, fname)
-
-z = zipfile.ZipFile(path)
-qgs_name = [n for n in z.namelist() if n.endswith('.qgs')][0]
-content = z.read(qgs_name).decode('utf-8')
-
-# 提取 Layout 元素(找 Map 项)
-# QGIS 有两种布局格式: (QGIS 2.x style) 和 (QGIS 3.x style)
-layout_re = re.compile(r'<(?:Composer|Layout)[^>]*name="([^"]*)"[^>]*>(.*?)(?:Composer|Layout)>', re.DOTALL)
-
-for m in layout_re.finditer(content):
- layout_name = m.group(1)
- layout_content = m.group(2)
- print(f"=== 布局: {layout_name} ===")
-
- # 检查 Map 项
- map_item_re = re.compile(r']*>(.*?)', re.DOTALL)
- for mm in map_item_re.finditer(layout_content):
- map_content = mm.group(1)
-
- # 检查是否有 lockedLayers
- locked = re.findall(r'(.*?)', map_content, re.DOTALL)
- if locked:
- print(f" lockedLayers: {locked[0][:500]}")
-
- # 检查 keepLayerSet
- keep_set = re.findall(r'keepLayerSet="([^"]*)"', mm.group(0))
- if keep_set:
- print(f" keepLayerSet: {keep_set[0]}")
-
- # 检查 followPreset
- preset = re.findall(r'followPreset="([^"]*)"', mm.group(0))
- if preset:
- print(f" followPreset: {preset[0]}")
-
- # 检查 followPresetName
- preset_name = re.findall(r'followPresetName="([^"]*)"', mm.group(0))
- if preset_name:
- print(f" followPresetName: {preset_name[0]}")
-
- # 检查
- layer_set = re.findall(r'(.*?)', map_content, re.DOTALL)
- if layer_set:
- print(f" layerSet: {layer_set[0][:500]}")
-
- # 检查
- grids = re.findall(r']*/>', map_content)
- print(f" grids: {len(grids)}")
-
- # 也检查 格式 (QGIS 3.x)
- map_item2_re = re.compile(r']*type="[^"]*map[^"]*"[^>]*>(.*?)', re.DOTALL | re.IGNORECASE)
- for mm in map_item2_re.finditer(layout_content):
- map_content = mm.group(1)
- print(f" [LayoutItem Map] attributes: {mm.group(0)[:300]}")
-
-# 打印模板中所有的 map theme / visibility preset
-presets = re.findall(r'<(?:visibility-presets|map-theme-collection).*?(?:visibility-presets|map-theme-collection)>', content, re.DOTALL)
-if presets:
- print("\n=== 可见性预设 ===")
- print(presets[0][:500])
diff --git a/app/script/check_shelter.py b/app/script/check_shelter.py
deleted file mode 100644
index 21fa7ef..0000000
--- a/app/script/check_shelter.py
+++ /dev/null
@@ -1,71 +0,0 @@
-"""检查暴雨避难场所分布图的所有动态图层是否有数据"""
-import zipfile, re, os, psycopg2
-
-TEMPLATE_PATH = r"F:\project\xian\xian_algorithm_new\app\data\template\rainfall\暴雨避难场所分布图.qgz"
-
-z = zipfile.ZipFile(TEMPLATE_PATH)
-qgs_name = [n for n in z.namelist() if n.endswith('.qgs')][0]
-content = z.read(qgs_name).decode('utf-8')
-
-maplayer_re = re.compile(r']*>(.*?)', re.DOTALL)
-
-# 收集所有 PostgreSQL 动态图层
-layers = []
-for m in maplayer_re.finditer(content):
- block = m.group(1)
- name_m = re.search(r'([^<]+)', block)
- provider_m = re.search(r']*>(\w+)', block)
- ds_m = re.search(r'(.*?)', block, re.DOTALL)
-
- provider = provider_m.group(1) if provider_m else '?'
- if provider != 'postgres':
- continue
-
- name = name_m.group(1) if name_m else '?'
- ds = ds_m.group(1).strip() if ds_m else ''
- table_m = re.search(r'table="(\w+)"\."(\w+)"', ds)
- table_key = f"{table_m.group(1)}.{table_m.group(2)}" if table_m else '?'
-
- layers.append((name, table_key))
-
-# 已知 GPKG 静态层
-static_tables = {
- 'base.rivers', 'base.river', 'base.sx', 'base.sx_capital',
- 'base.sx_street', 'base.sx_xa_county', 'base.sx_xa_county_boundary',
- 'base.sx_zb_county_boundary', 'base.sx_zb_city', 'base.sx_zb_county',
- 'base.active_fault', 'base.traffic_expressway', 'base.traffic_provincial',
- 'base.traffic_railway', 'base.traffic_township', 'base.traffic_trunk_line',
-}
-
-c = psycopg2.connect(host='47.92.216.173', port=7654, user='postgres', password='zhangsan', database='xian_new')
-c.autocommit = True
-cur = c.cursor()
-
-print(f"模板: 暴雨避难场所分布图")
-print(f"{'图层名':20s} {'原表':40s} {'qgis有数据':10s} {'行数':>6s}")
-print("-" * 85)
-
-for name, table_key in layers:
- if table_key in static_tables:
- continue
-
- schema, table = table_key.split('.', 1)
- mapped_table = 'hazard_hydrops' if table == 'hazard_waterlogging' else table
-
- try:
- cur.execute(f'SELECT count(*) FROM qgis.{mapped_table}')
- count = cur.fetchone()[0]
- exists = "YES" if count > 0 else "EMPTY"
- except:
- try:
- cur.execute(f'SELECT count(*) FROM {schema}.{table}')
- count = cur.fetchone()[0]
- exists = f"在{schema}"
- except:
- exists = "NO"
- count = 0
-
- marker = " <-- 无数据!" if count == 0 else ""
- print(f"{name:20s} {table_key:40s} {exists:10s} {count:>6,d}{marker}")
-
-c.close()
diff --git a/app/script/list_shelter_layers.py b/app/script/list_shelter_layers.py
deleted file mode 100644
index 39d93dc..0000000
--- a/app/script/list_shelter_layers.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import zipfile, re
-
-z = zipfile.ZipFile(r"F:\project\xian\xian_algorithm_new\app\data\template\rainfall\暴雨避难场所分布图.qgz")
-c = z.read([n for n in z.namelist() if n.endswith('.qgs')][0]).decode()
-layers = re.findall(r']*>(.*?)', c, re.DOTALL)
-
-for i, l in enumerate(layers):
- nm = re.search(r'([^<]+)', l)
- pv = re.search(r']*>(\w+)', l)
- ds = re.search(r'(.*?)', l, re.DOTALL)
- name = nm.group(1) if nm else '?'
- prov = pv.group(1) if pv else '?'
- ds_text = ds.group(1).strip()[:120] if ds else ''
- print(f"{i:2d}. [{prov:10s}] {name}")
- if ds_text:
- print(f" ds: {ds_text}")