QGIS SAGA – Fixing Layers Not Correctly Generated Using SAGA Algorithms in QGIS

qgissaga

I am trying to use a few algorithms that may be useful for my work, that are part of the processing tools packaged with the latest LTR 64-bit version of QGIS in Windows 10 64 bit.. However, all of the SAGA algorithms that I have tried so far throw the same final error, regarding layers that were not correctly generated. The following image is the end of the log message I get. In red is the error I mention. It happens with all tools I have tried so far.

Log capture

I checked other posts and read similar issues. Some suggestions to fix it included using different paths, and avoiding blank spaces in them.
I tried changing the path to a D:\Temp directory but no success.

Things I noticed:

  • In the log, some paths appear with forward slash (/), as in Unix systems.
  • Some long paths appear shortened, using the tilde (~). In particular, C:\OSGeo4W64 gets shortened to C:\OSGeo4~1

Any hints?

EDIT:

This is the output log provided in comments:

Procesando algoritmo...

Algoritmo 'Profiles from lines' comenzando…

Parámetros de entrada:

{ 'DEM' : 'F:/Dropbox/QGIS_Test/DEM.tif', 'LINES' : 'F:\\Dropbox\\QGIS_Test\\Lines.shp', 'NAME' : 'id', 'PROFILE' : 'C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/8d34e08d5a984c11a8ffce8b99fadd36/PROFILE.shp', 'PROFILES' : 'C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/acbe581a52b9406fb5db4af3292f919a/PROFILES.shp', 'SPLIT ' : True, 'VALUES' : '' }


io_gdal 0 -TRANSFORM 1 -RESAMPLING 3 -GRIDS "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/635ead2d3ee34f7bbeda0d5905c407b0/DEM.sgrd" -FILES "F:\Dropbox\QGIS_Test\DEM.tif"

ta_profiles "Profiles from Lines" -DEM "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/635ead2d3ee34f7bbeda0d5905c407b0/DEM.sgrd" -LINES "F:\Dropbox\QGIS_Test\Lines.shp" -NAME "id" -SPLIT true -PROFILE "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/8d34e08d5a984c11a8ffce8b99fadd36/PROFILE.shp" -PROFILES "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/acbe581a52b9406fb5db4af3292f919a/PROFILES.shp"


F:\Dropbox\QGIS_Test>set SAGA=C:/PROGRA~2/QGIS3~1.4/apps\saga-ltr


F:\Dropbox\QGIS_Test>set SAGA_MLB=C:/PROGRA~2/QGIS3~1.4/apps\saga-ltr\modules


F:\Dropbox\QGIS_Test>PATH=C:\PROGRA~2\QGIS3~1.4\apps\qgis\bin;C:\PROGRA~2\QGIS3~1.4\apps\Python37;C:\PROGRA~2\QGIS3~1.4\apps\Python37\Scripts;C:\PROGRA~2\QGIS3~1.4\apps\qt5\bin;C:\PROGRA~2\QGIS3~1.4\apps\Python27\Scripts;C:\PROGRA~2\QGIS3~1.4\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem;C:\PROGRA~2\QGIS3~1.4\apps\Python37\lib\site-packages\pywin32_system32;C:\PROGRA~2\QGIS3~1.4\apps\Python37\lib\site-packages\numpy\.libs;C:/PROGRA~2/QGIS3~1.4/apps\saga-ltr;C:/PROGRA~2/QGIS3~1.4/apps\saga-ltr\modules


F:\Dropbox\QGIS_Test>saga_cmd io_gdal 0 -TRANSFORM 1 -RESAMPLING 3 -GRIDS "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/635ead2d3ee34f7bbeda0d5905c407b0/DEM.sgrd" -FILES "F:\Dropbox\QGIS_Test\DEM.tif"

____________________________


##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

____________________________


SAGA Version: 2.3.2 (32 bit)


____________________________

library path: C:\PROGRA~2\QGIS3~1.4\apps\saga-ltr\modules\

library name: io_gdal

library : GDAL/OGR

tool : Import Raster

author : O.Conrad (c) 2007 (A.Ringeler)

processors : 8 [8]

____________________________




Parameters



Grids: No objects

Files: "F:\Dropbox\QGIS_Test\DEM.tif"

Select from Multiple Bands:

Alphanumeric Sorting: yes

Transformation: yes

Resampling: B-Spline Interpolation



loading: F:\Dropbox\QGIS_Test\DEM.tif




Driver: GTiff


Bands: 1


Rows: 5557


Columns: 7445



loading: DEM






F:\Dropbox\QGIS_Test>saga_cmd ta_profiles "Profiles from Lines" -DEM "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/635ead2d3ee34f7bbeda0d5905c407b0/DEM.sgrd" -LINES "F:\Dropbox\QGIS_Test\Lines.shp" -NAME "id" -SPLIT true -PROFILE "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/8d34e08d5a984c11a8ffce8b99fadd36/PROFILE.shp" -PROFILES "C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/acbe581a52b9406fb5db4af3292f919a/PROFILES.shp"

Error: dbf write: invalid table

____________________________


##### ## ##### ##

### ### ## ###

### # ## ## #### # ##

### ##### ## # #####

##### # ## ##### # ##

____________________________


SAGA Version: 2.3.2 (32 bit)


____________________________

library path: C:\PROGRA~2\QGIS3~1.4\apps\saga-ltr\modules\

library name: ta_profiles

library : Profiles

tool : Profiles from Lines

author : O.Conrad (c) 2006

processors : 8 [8]

____________________________


Load grid: C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/635ead2d3ee34f7bbeda0d5905c407b0/DEM.sgrd...



Load shapes: F:\Dropbox\QGIS_Test\Lines.shp...





Parameters



Grid system: 5; 5557x 7445y; 511960x 4649730y

DEM: DEM

Values: No objects

Lines: Lines

Name: id

Profiles: Profiles

Profiles: No objects

Each Line as new Profile: yes




failed

Save shapes: C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/acbe581a52b9406fb5db4af3292f919a/PROFILES.shp_1...



Save shapes: C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/acbe581a52b9406fb5db4af3292f919a/PROFILES.shp_2...




F:\Dropbox\QGIS_Test>exit

Ejecución completada en 12.90 segundos

Resultados:

{'PROFILE': 'C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/8d34e08d5a984c11a8ffce8b99fadd36/PROFILE.shp',
'PROFILES': 'C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/acbe581a52b9406fb5db4af3292f919a/PROFILES.shp'}


Cargando las capas resultantes

Las siguientes capas no se generaron correctamente.<ul><li>C:/Users/Kais/AppData/Local/Temp/processing_5080f69b88474281943ae5c46597245d/8d34e08d5a984c11a8ffce8b99fadd36/PROFILE.shp</li></ul>Puede comprobar el «Panel de mensajes del registro» en la ventana principal de QGIS para encontrar más información sobre la ejecución del algoritmo.  

Best Answer

There are some problems with the Profiles from lines algorithm in QGIS.

Let's see first how it should work.

In SAGA GIS, at the command line:

  • If you want to save Each Line as a New Profile, you need to use the -SPLIT and the -PROFILES options. Files will be saved as profile_01.shp, profile_02.shp, etc.

  • If not, don't use -SPLIT option and use -PROFILE option. File will be saved as profile.shp.

In QGIS processing toolbox:

  • Both -PROFILE and -PROFILES options are always used, so one of them always returns an error (The following layers were not correctly generated.).

  • If you tick on Each Line as a New Profile (is ticked by default), -SPLIT option is used, and the files are saved as PROFILE.shp1, PROFILE.shp2, etc. That produced two errors (one for the -PROFILE empty layer and other for the invalid extensions).

A bug report was already opened: https://issues.qgis.org/issues/21294.

Meanwhile, a possible workaround is to not use the Each Line as a New Profile option (untick it) and ignore the error generated by the -PROFILE over option.

Related Question