添加产图顺序
This commit is contained in:
@@ -309,6 +309,20 @@ async def export_map(req: QgisMapExportRequest):
|
|||||||
f for f in os.listdir(template_dir)
|
f for f in os.listdir(template_dir)
|
||||||
if f.endswith(".qgz") and not f.startswith("tmp")
|
if f.endswith(".qgz") and not f.startswith("tmp")
|
||||||
])
|
])
|
||||||
|
# 优先模板排到前面
|
||||||
|
priority_keywords = getattr(settings, "QGIS_PRIORITY_TEMPLATES", [])
|
||||||
|
if priority_keywords:
|
||||||
|
def _priority_order(name: str) -> tuple:
|
||||||
|
for i, kw in enumerate(priority_keywords):
|
||||||
|
if kw in name:
|
||||||
|
return (0, i) # 优先组,按配置顺序
|
||||||
|
return (1, name) # 非优先组,按文件名
|
||||||
|
template_files.sort(key=_priority_order)
|
||||||
|
priority_count = sum(
|
||||||
|
1 for f in template_files
|
||||||
|
if any(kw in f for kw in priority_keywords)
|
||||||
|
)
|
||||||
|
logger.info(f"优先模板: {priority_count} 张排前面")
|
||||||
|
|
||||||
if not template_files:
|
if not template_files:
|
||||||
raise FileNotFoundError(f"模板文件夹为空: {template_dir}")
|
raise FileNotFoundError(f"模板文件夹为空: {template_dir}")
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ QGIS_DEFAULTS_MAP_UNIT = "制图单位:西安市应急管理局"
|
|||||||
QGIS_EXPORT_DPI = 300
|
QGIS_EXPORT_DPI = 300
|
||||||
# 并行子进程数(每进程独立 QGIS 实例)
|
# 并行子进程数(每进程独立 QGIS 实例)
|
||||||
QGIS_PARALLEL_WORKERS = 4
|
QGIS_PARALLEL_WORKERS = 4
|
||||||
|
# 优先产出模板
|
||||||
|
QGIS_PRIORITY_TEMPLATES = ["暴雨地质灾害风险区分布图", "暴雨滑坡潜在隐患点及人口分布图", "暴雨山洪潜在隐患点及人口分布图", "暴雨泥石流潜在隐患点及人口分布图", "暴雨内涝潜在隐患点及人口分布图", "暴雨避难场所分布图"]
|
||||||
|
|
||||||
# 西安市中心经纬度
|
# 西安市中心经纬度
|
||||||
XIAN_CENTER = [108.948024, 34.263161]
|
XIAN_CENTER = [108.948024, 34.263161]
|
||||||
|
|||||||
Reference in New Issue
Block a user