QGIS调用SAGA生成河网与流域图层失败问题求助
QGIS 3.34.0 + SAGA 流域提取失败问题解决
问题现象
- 在QGIS 3.34.0中调用SAGA Next Gen的Channel Network and Drainage Basins工具从DEM提取流域时,弹出
The following layers were not correctly generated错误 - 尝试将输出改为非临时文件、更换工作目录后问题仍未解决
核心错误原因
从执行日志可定位两个关键问题:
- 版本不兼容:当前安装的SAGA版本为7.3.0,而该工具要求最低版本为9.1
- 参数不匹配:QGIS向SAGA传递了
SUBBASINS参数,但SAGA 7.3.0的该工具不支持此参数,导致命令执行失败
解决方案
方案1:升级SAGA到兼容版本
- 卸载现有SAGA 7.3.0版本
- 安装SAGA 9.1或更高版本(需确保与QGIS 3.34.0兼容)
- 重启QGIS后重新运行工具,此时
SUBBASINS参数可被正确识别
方案2:使用替代工具(无需升级)
若暂时无法升级SAGA,可选择以下兼容方案:
- 使用无Next Gen标识的旧版SAGAChannel Network and Drainage Basins工具
- 改用QGIS原生的Watershed工具(无需依赖SAGA)
完整错误日志
QGIS version: 3.34.0-Prizren QGIS code revision: ffbdd678812 Qt version: 5.15.3 Python version: 3.10.12 GDAL version: 3.4.1 GEOS version: 3.10.2-CAPI-1.16.0 PROJ version: Rel. 8.2.1, January 1st, 2022 PDAL version: 2.3.0 (git-version: Release) SAGA Next Gen version: 1.0.0 Algorithm started at: 2023-11-04T13:02:37 Algorithm 'Channel network and drainage basins' starting… Input parameters: { 'BASIN' : 'TEMPORARY_OUTPUT', 'BASINS' : 'TEMPORARY_OUTPUT', 'CONNECTION' : 'TEMPORARY_OUTPUT', 'DEM' : '/tmp/processing_jFVHbY/c71f7863c5cd40b98a83e56596437892/TARGET_OUT_GRID.sdat', 'DIRECTION' : 'TEMPORARY_OUTPUT', 'NODES' : 'TEMPORARY_OUTPUT', 'ORDER' : 'TEMPORARY_OUTPUT', 'SEGMENTS' : 'TEMPORARY_OUTPUT', 'SUBBASINS' : True, 'THRESHOLD' : 5 } Problem with SAGA installation: unsupported SAGA version (found: 7.3.0, required: >=9.1.). ta_channels "5" -DEM "/tmp/processing_jFVHbY/35f004a1f92d49288c8836a5943964d4/TargetGrid.sgrd" -THRESHOLD 5 -SUBBASINS true -DIRECTION "/tmp/processing_jFVHbY/26054a9b76bc4e2694fd7c85891223af/DIRECTION.sdat" -CONNECTION "/tmp/processing_jFVHbY/8f09f4a88306449b81f7f0f244fe973f/CONNECTION.sdat" -ORDER "/tmp/processing_jFVHbY/4b99f7ff5a414954b4bb1b0e50766cba/ORDER.sdat" -BASIN "/tmp/processing_jFVHbY/69b59a2344fa4524b20cae335ceb4d19/BASIN.sdat" -SEGMENTS "/tmp/processing_jFVHbY/6a47017369c84ccfaa2f03f81c4e09cc/SEGMENTS.shp" -BASINS "/tmp/processing_jFVHbY/5813a16995c8486280959a1abffa86a7/BASINS.shp" -NODES "/tmp/processing_jFVHbY/63312dc8e86f405284e478ce48ce888b/NODES.shp" SAGA Version: 7.3.0 Unknown option 'SUBBASINS' ____________________________ library path: /usr/lib/x86_64-linux-gnu/saga/ library name: libta_channels library : ta_channels tool : Channel Network and Drainage Basins identifier : 5 author : O.Conrad (c) 2003 processors : 16 [16] ____________________________ Usage: saga_cmd ta_channels 5 [-DEM <str>] [-DIRECTION <str>] [-CONNECTION <str>] [-ORDER <str>] [-BASIN <str>] [-SEGMENTS <str>] [-BASINS <str>] [-NODES <str>] [-THRESHOLD <num>] -DEM:<str> Elevation Grid (input) -DIRECTION:<str> Flow Direction Grid (optional output) -CONNECTION:<str> Flow Connectivity Grid (optional output) -ORDER:<str> Strahler Order Grid (optional output) -BASIN:<str> Drainage Basins Grid (optional output) -SEGMENTS:<str> Channels Shapes (output) -BASINS:<str> Drainage Basins Shapes (output) -NODES:<str> Junctions Shapes (optional output) -THRESHOLD:<num> Threshold Integer Minimum: 1 Default: 5 Execution completed in 0.19 seconds Results: {'BASIN': '/tmp/processing_jFVHbY/69b59a2344fa4524b20cae335ceb4d19/BASIN.sdat', 'BASINS': '/tmp/processing_jFVHbY/5813a16995c8486280959a1abffa86a7/BASINS.shp', 'CONNECTION': '/tmp/processing_jFVHbY/8f09f4a88306449b81f7f0f244fe973f/CONNECTION.sdat', 'DIRECTION': '/tmp/processing_jFVHbY/26054a9b76bc4e2694fd7c85891223af/DIRECTION.sdat', 'NODES': '/tmp/processing_jFVHbY/63312dc8e86f405284e478ce48ce888b/NODES.shp', 'ORDER': '/tmp/processing_jFVHbY/4b99f7ff5a414954b4bb1b0e50766cba/ORDER.sdat', 'SEGMENTS': '/tmp/processing_jFVHbY/6a47017369c84ccfaa2f03f81c4e09cc/SEGMENTS.shp'} Loading resulting layers The following layers were not correctly generated. • /tmp/processing_jFVHbY/26054a9b76bc4e2694fd7c85891223af/DIRECTION.sdat • /tmp/processing_jFVHbY/4b99f7ff5a414954b4bb1b0e50766cba/ORDER.sdat • /tmp/processing_jFVHbY/5813a16995c8486280959a1abffa86a7/BASINS.shp • /tmp/processing_jFVHbY/63312dc8e86f405284e478ce48ce888b/NODES.shp • /tmp/processing_jFVHbY/69b59a2344fa4524b20cae335ceb4d19/BASIN.sdat • /tmp/processing_jFVHbY/6a47017369c84ccfaa2f03f81c4e09cc/SEGMENTS.shp • /tmp/processing_jFVHbY/8f09f4a88306449b81f7f0f244fe973f/CONNECTION.sdat You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
内容的提问来源于stack exchange,提问作者ASJ
相关产品推荐
相关产品推荐

