3

I've tried multiple SAGA processing tools (Tools tried include: "clip raster with polygon". "Fill sinks Fill sinks (Wang and Liu)". "Polygon Centroids.". It seems that none are working and I always get the same error message: "Loading resulting layers The following layers were not correctly generated" I can't find the files in the directories where they should be saved.

I have tried reinstalling QGIS and switching from different versions and. I have tried to save the output-files in directories that lack spaces in their names. The CRS for inputfiles are the same as the project's (3006, Sweref 99TM). I have tried disabling "load upon completion".

I tried using the SAGA GUI also (the seperate SAGA programme outside of WGIS) and the analyses work there. I tried these two processes: and both work: "Fill sinks (Wang & Liu)" and "Polygon to centroids". When in QGIS and using "Polygon to centroids", trying to save as a shapefile results in the same error. However a prj-file is generated and saved in the directory but no other files are saved.

I have tried starting a new QGIS-project for doing the analyses and also tried to do the analyses on another computer through the Qgis version 3.16.4. Neither of these options worked.

I can't recall SAGA ever working for me in QGIS before but I'm not sure. Might have used it successfully a long time ago...

This is the full processing log:

"QGIS version: 3.22.14-Białowieża
QGIS code revision: 4cde646c
Qt version: 5.15.3
Python version: 3.9.5
GDAL version: 3.6.1
GEOS version: 3.11.1-CAPI-1.17.1
PROJ version: Rel. 9.1.1, December 1st, 2022
PDAL version: 2.4.3 (git-version: f8d673)
SAGA version 7.8.2 is not officially supported - algorithms may encounter issues
Algorithm started at: 2022-12-27T22:07:41
Algorithm 'Clip Raster with Polygon' starting…
Input parameters:
{ 'EXTENT' : 2, 'INPUT' : ['C:/Users/vilhelm.moran/OneDrive - Enviroplanning/MAPP MED TILLFÄLLIGT INNEHÅLL/Våtmark mossen 2022-2023/GIS/Data Hannes Privat/Modified DEM.tif'], 'OUTPUT' : 'TEMPORARY_OUTPUT', 'POLYGONS' : 'C:/Users/vilhelm.moran/OneDrive - Enviroplanning/MAPP MED TILLFÄLLIGT INNEHÅLL/Våtmark mossen 2022-2023/GIS/Data Hannes Privat/Vector1.shp' }
io_gdal 0 -TRANSFORM 1 -RESAMPLING 3 -GRIDS "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_CjnbZv/85069a35ab094eb6b63ba1f02a8d1916/ModifiedDEM.sgrd" -FILES "C:/Users/vilhelm.moran/OneDrive - Enviroplanning/MAPP MED TILLFÄLLIGT INNEHÅLL/Våtmark mossen 2022-2023/GIS/Data Hannes Privat/Modified DEM.tif"
shapes_grid "Clip Grid with Polygon" -INPUT "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_CjnbZv/85069a35ab094eb6b63ba1f02a8d1916/ModifiedDEM.sgrd" -POLYGONS "C:/Users/vilhelm.moran/OneDrive - Enviroplanning/MAPP MED TILLFÄLLIGT INNEHÅLL/Våtmark mossen 2022-2023/GIS/Data Hannes Privat/Vector1.shp" -EXTENT 2 -OUTPUT "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_CjnbZv/5add548c845a49a2b95b8c75a395691d/OUTPUT.sdat"
C:\Users\vilhelm.moran\Documents>set SAGA=C:/OSGeo4W/apps\saga
C:\Users\vilhelm.moran\Documents>set SAGA_MLB=C:/OSGeo4W/apps\saga\modules
C:\Users\vilhelm.moran\Documents>PATH=C:\OSGeo4W\apps\qgis-ltr\bin;C:\OSGeo4W\apps\grass\grass78\lib;C:\OSGeo4W\apps\grass\grass78\bin;C:\OSGeo4W\apps\qt5\bin;C:\OSGeo4W\apps\Python39\Scripts;C:\OSGeo4W\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem;C:/OSGeo4W/apps\saga;C:/OSGeo4W/apps\saga\modules
C:\Users\vilhelm.moran\Documents>call saga_cmd io_gdal 0 -TRANSFORM 1 -RESAMPLING 3 -GRIDS "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_CjnbZv/85069a35ab094eb6b63ba1f02a8d1916/ModifiedDEM.sgrd" -FILES "C:/Users/vilhelm.moran/OneDrive - Enviroplanning/MAPP MED TILLFÄLLIGT INNEHÅLL/Våtmark mossen 2022-2023/GIS/Data Hannes Privat/Modified DEM.tif"
____________________________
##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________
SAGA Version: 7.8.2 (64 bit)
____________________________
library path: C:\OSGeo4W\apps\saga\tools\
library name: io_gdal
library : io_gdal
tool : Import Raster
identifier : 0
author : O.Conrad (c) 2007 (A.Ringeler)
processors : 4 [4]
____________________________
Execution completed in 9.38 seconds
Results:
{'OUTPUT': 'C:/Users/vilhelm.moran/AppData/Local/Temp/processing_CjnbZv/5add548c845a49a2b95b8c75a395691d/OUTPUT.sdat'}
Loading resulting layers
The following layers were not correctly generated.
• C:/Users/vilhelm.moran/AppData/Local/Temp/processing_CjnbZv/5add548c845a49a2b95b8c75a395691d/OUTPUT.sdat
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm."
8
  • It looks like you are saving to a temporary output. It might help if you specify a save location.
    – Matt
    Dec 27, 2022 at 22:33
  • 1
    If you save to a shapefile does it work? If you run the SAGA tool(s) from the SAGA GUI (admittedly not as easy to use as QGIS but this is more of a test) do you get expected results?
    – John
    Dec 27, 2022 at 23:45
  • @john I tried using the SAGA GUI now and the analyses work there. I tried these two processes: and both work: "Fill sinks (Wang & Liu)" and "Polygon to centroids". When in QGIS and using "Polygon to centroids", trying to save as a shapefile results in the same error. However a prj-file is generated and saved in the directory but no other files are saved.
    – Vilhelm
    Dec 28, 2022 at 8:42
  • @Matt I have tried to save in a location but it didn't work either. The same error appears.
    – Vilhelm
    Dec 28, 2022 at 8:43
  • My other thought was that perhaps it's because there is a . in your filepath. I don't know how fussy SAGA is about directory names.
    – Matt
    Dec 28, 2022 at 9:27

1 Answer 1

1

I got all previously tried SAGA tools to work. How did I do it? It seems that SAGA could not handle the directory of my input files. When I moved the input files to other directories and then ran them with the SAGA tools within QGIS everything worked fine. All I need to do now is to set up a different working folder for my future projects.

This is one of the successfull processing logs:

QGIS version: 3.22.14-Białowieża
QGIS code revision: 4cde646c
Qt version: 5.15.3
Python version: 3.9.5
GDAL version: 3.6.1
GEOS version: 3.11.1-CAPI-1.17.1
PROJ version: Rel. 9.1.1, December 1st, 2022
PDAL version: 2.4.3 (git-version: f8d673)
SAGA version 7.8.2 is not officially supported - algorithms may encounter issues
Algorithm started at: 2022-12-29T09:38:20
Algorithm 'Fill Sinks (Wang & Liu)' starting…
Input parameters:
{ 'ELEV' : 'C:/Users/vilhelm.moran/Desktop/test 2.tif', 'FDIR' : 'TEMPORARY_OUTPUT', 'FILLED' : 'TEMPORARY_OUTPUT', 'MINSLOPE' : 0.1, 'WSHED' : 'TEMPORARY_OUTPUT' }

io_gdal 0 -TRANSFORM 1 -RESAMPLING 3 -GRIDS "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/a9325f0e0ded4c83a778f2a520ebe29f/test2.sgrd" -FILES "C:/Users/vilhelm.moran/Desktop/test 2.tif"
ta_preprocessor "Fill Sinks (Wang & Liu)" -ELEV "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/a9325f0e0ded4c83a778f2a520ebe29f/test2.sgrd" -MINSLOPE 0.1 -FILLED "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/1e55d5ac4ec148c1b41d5174ddb46921/FILLED.sdat" -FDIR "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/25cb9a3bba6b40d8bf808be78f34b048/FDIR.sdat" -WSHED "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/31c1f7c96d584ab8a2880adeec5b0f7b/WSHED.sdat"

C:\Users\vilhelm.moran\Documents>set SAGA=C:/OSGeo4W/apps\saga

C:\Users\vilhelm.moran\Documents>set SAGA_MLB=C:/OSGeo4W/apps\saga\modules

C:\Users\vilhelm.moran\Documents>PATH=C:\OSGeo4W\apps\qgis-ltr\bin;C:\OSGeo4W\apps\grass\grass78\lib;C:\OSGeo4W\apps\grass\grass78\bin;C:\OSGeo4W\apps\qt5\bin;C:\OSGeo4W\apps\Python39\Scripts;C:\OSGeo4W\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem;C:/OSGeo4W/apps\saga;C:/OSGeo4W/apps\saga\modules

C:\Users\vilhelm.moran\Documents>call saga_cmd io_gdal 0 -TRANSFORM 1 -RESAMPLING 3 -GRIDS "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/a9325f0e0ded4c83a778f2a520ebe29f/test2.sgrd" -FILES "C:/Users/vilhelm.moran/Desktop/test 2.tif"
____________________________

##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________

SAGA Version: 7.8.2 (64 bit)

____________________________
library path: C:\OSGeo4W\apps\saga\tools\
library name: io_gdal
library : io_gdal
tool : Import Raster
identifier : 0
author : O.Conrad (c) 2007 (A.Ringeler)
processors : 4 [4]
____________________________



Parameters


Grids: No objects
Files: "C:/Users/vilhelm.moran/Desktop/test 2.tif"
Multiple Bands Output: automatic
Select from Multiple Bands:
Transformation: true
Resampling: B-Spline Interpolation
Extent: original


loading: C:/Users/vilhelm.moran/Desktop/test 2.tif



Driver: GTiff

Bands: 1

Rows: 5000

Columns: 5000


loading: test 2


Saving grid: C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/a9325f0e0ded4c83a778f2a520ebe29f/test2.sgrd...



C:\Users\vilhelm.moran\Documents>call saga_cmd ta_preprocessor "Fill Sinks (Wang & Liu)" -ELEV "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/a9325f0e0ded4c83a778f2a520ebe29f/test2.sgrd" -MINSLOPE 0.1 -FILLED "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/1e55d5ac4ec148c1b41d5174ddb46921/FILLED.sdat" -FDIR "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/25cb9a3bba6b40d8bf808be78f34b048/FDIR.sdat" -WSHED "C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/31c1f7c96d584ab8a2880adeec5b0f7b/WSHED.sdat"
____________________________

##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________

SAGA Version: 7.8.2 (64 bit)

____________________________
library path: C:\OSGeo4W\apps\saga\tools\
library name: ta_preprocessor
library : ta_preprocessor
tool : Fill Sinks (Wang & Liu)
identifier : 4
author : Copyrights (c) 2007 by Volker Wichmann
processors : 4 [4]
____________________________

Loading grid: C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/a9325f0e0ded4c83a778f2a520ebe29f/test2.sgrd...




Parameters


Grid System: 1; 5000x 5000y; 295000.5x 6510000.5y
DEM: test2
Filled DEM:
Flow Directions:
Watershed Basins:
Minimum Slope [Degree]: 0.100000





Saving grid: C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/25cb9a3bba6b40d8bf808be78f34b048/FDIR.sdat...


Saving grid: C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/31c1f7c96d584ab8a2880adeec5b0f7b/WSHED.sdat...



C:\Users\vilhelm.moran\Documents>exit
Execution completed in 55.59 seconds
Results:
{'FDIR': 'C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/25cb9a3bba6b40d8bf808be78f34b048/FDIR.sdat',
'FILLED': 'C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/1e55d5ac4ec148c1b41d5174ddb46921/FILLED.sdat',
'WSHED': 'C:/Users/vilhelm.moran/AppData/Local/Temp/processing_uKqhid/31c1f7c96d584ab8a2880adeec5b0f7b/WSHED.sdat'}

Loading resulting layers
Algorithm 'Fill Sinks (Wang & Liu)' finished

I will say however that it's a bit surprising that if I open the SAGA gui (separated from QGIS) and run the SAGA tools from there I don't need to change directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.