chore: 暂停生成移动WIFI楼宇专题

This commit is contained in:
nixevol
2026-09-23 09:44:13 +08:00
parent c6401079b8
commit f66f829376
3 changed files with 10 additions and 5 deletions
+5 -2
View File
@@ -10,13 +10,16 @@ from .gpkg import quote_identifier
STYLES = Path(__file__).with_name('styles')
THEMES = json.loads((STYLES / 'themes.json').read_text(encoding='utf-8'))
# 暂停生成移动 WIFI 专题;保留其样板、字段和代码,后续恢复时只需改回 THEMES。
ACTIVE_THEMES = [theme for theme in THEMES if theme['key'] != 'mobile_wifi']
# ACTIVE_THEMES = THEMES # 需要恢复移动 WIFI 专题时启用这一行,并停用上一行。
def export_themes(source_path):
results = []
with closing(sqlite3.connect(source_path)) as source:
available = {r[1] for r in source.execute('pragma table_info(NRBuildingsData)')}
for theme in THEMES:
for theme in ACTIVE_THEMES:
fields = ['fid', *[name for name, _ in theme['fields']], 'geom']
missing = set(fields) - available
if missing:
@@ -48,7 +51,7 @@ def add_theme_layers(root, extent):
remove_qgis_layer(root, 'NRBuildingsData.gpkg', required=False)
tree = root.find('layer-tree-group')
# 倒序插入,保持样板中 C 端在 WIFI 上方。
for theme in reversed(THEMES):
for theme in reversed(ACTIVE_THEMES):
filename = theme['name'] + '.gpkg'
remove_qgis_layer(root, filename, required=False)
layer = ET.parse(STYLES / (theme['key'] + '.xml')).getroot()