jblindsay / whitebox_workflows_for_qgis

A QGIS frontend for Whitebox Workflows for Python
GNU General Public License v3.0
5 stars 0 forks source link

Error when running a few tools ("The following layers were not correctly generated") #3

Closed fsdias closed 7 months ago

fsdias commented 7 months ago

Linux Ubuntu 22.04 QGIS 3.34.3

Installed Whitebox as follows:

fd@fd:~$ pip3 install whitebox-workflows
Defaulting to user installation because normal site-packages is not writeable
Collecting whitebox-workflows
  Using cached whitebox_workflows-1.2.2-cp38-abi3-manylinux_2_31_x86_64.whl (11.2 MB)
Installing collected packages: whitebox-workflows
Successfully installed whitebox-workflows-1.2.2

I'm getting the following errors when I run: "Add point coordinates table", "clean vector" and "Export table to csv".

QGIS version: 3.34.3-Prizren
QGIS code revision: cc9d733e5f1
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)
Algorithm started at: 2024-02-27T14:27:05
Algorithm 'Add point coordinates to table' starting…
Input parameters:
{ 'fnOutput' : 'TEMPORARY_OUTPUT', 'input1' : '/mnt/fd/FilipeTrabalho/VA/va_analysis/bares2023.shp' }

WbW Script:
import os, sys
path = os.path.normpath(r"/home/fd/.local/share/QGIS/QGIS3/profiles/default/python/plugins/whitebox_workflows_for_qgis")
if path not in sys.path:
sys.path.append(path)

from whitebox_workflows import WbEnvironment
wbe = WbEnvironment()
wbe.verbose = True
wbe.max_procs = -1
wbe.working_directory = os.path.normpath(r"/mnt/fd/FilipeTrabalho/VA/va_analysis")
vector_1 = wbe.read_vector('bares2023.shp')
outputVector = wbe.add_point_coordinates_to_table(vector_1)
wbe.write_vector(outputVector, 'fnOutput.gpkg')

Process completed successfully.
Execution completed in 0.05 seconds
Results:
{'fnOutput': <QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {'fileEncoding': 'UTF-8'}}>}

In Log Messages, I get this message:

2024-02-27T14:27:05 WARNING Cannot open /tmp/processing_gaXgKD/b32a1cab6c954b58936aa0f43e9aaeb3/fnOutput.gpkg ().()

jblindsay commented 7 months ago

Try specifying the output file name rather than using QGIS's temporary file. Let me know if that works.

fsdias commented 7 months ago

"Export to csv" - it works if I specify the output name "Clean vector" - I get this error:

QGIS version: 3.34.3-Prizren
QGIS code revision: cc9d733e5f1
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)
Algorithm started at: 2024-02-27T14:52:03
Algorithm 'Clean vector' starting…
Input parameters:
{ 'fnOutput' : '/home/fd/Desktop/teste.shp', 'input1' : '/mnt/fd/FilipeTrabalho/VA/bar_proj/arroios.shp' }

WbW Script:
import os, sys
path = os.path.normpath(r"/home/fd/.local/share/QGIS/QGIS3/profiles/default/python/plugins/whitebox_workflows_for_qgis")
if path not in sys.path:
sys.path.append(path)

from whitebox_workflows import WbEnvironment
wbe = WbEnvironment()
wbe.verbose = True
wbe.max_procs = -1
wbe.working_directory = os.path.normpath(r"/mnt/fd/FilipeTrabalho/VA/bar_proj")
vector_1 = wbe.read_vector('arroios.shp')
outputVector = wbe.clean_vector(vector_1)
wbe.write_vector(outputVector, 'teste.shp')

********************************************
* Welcome to clean_vector *
* Powered by Whitebox Workflows for Python *
* www.whiteboxgeo.com *
********************************************
Process completed successfully.
Execution completed in 0.04 seconds
Results:
{'fnOutput': <QgsProcessingOutputLayerDefinition {'sink':/home/fd/Desktop/teste.shp, 'createOptions': {'fileEncoding': 'UTF-8'}}>}

Loading resulting layers
The following layers were not correctly generated.
• /home/fd/Desktop/teste.shp
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
jblindsay commented 7 months ago

I think you'll find that it's written the file to this directory /mnt/fd/FilipeTrabalho/VA/bar_proj. Let me know if this is the case.

jblindsay commented 7 months ago

I just released a new version (v1.2.1) that should fix this issue. It is awaiting approval in the QGIS plugin repository but when it is eventually approved, if you can please update and test with your data. I'm closing this issue now but please feel free to re-open if you find that the issue persists after updating to the new version. Thank you for taking the time to report this issue.

fsdias commented 7 months ago

Just downloaded version 1.21. If I choose "save to temporary" file I get this error message. Otherwise it works as expected. Let me know I can help you troubleshoot this issue. Happy to test a new version if you share it as .zip file.

QGIS version: 3.36.0-Maidenhead
QGIS code revision: 5bb9993d97a
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)
Algorithm started at: 2024-03-01T08:51:31
Algorithm 'Clean vector' starting…
Input parameters:
{ 'fnOutput' : 'TEMPORARY_OUTPUT', 'input1' : '/mnt/fd/FilipeTrabalho/VA/bar_proj/anjos.shp' }

WbW Script:
import os, sys
path = os.path.normpath(r"/home/fd/.local/share/QGIS/QGIS3/profiles/default/python/plugins/whitebox_workflows_for_qgis")
if path not in sys.path:
sys.path.append(path)

from whitebox_workflows import WbEnvironment
wbe = WbEnvironment()
wbe.verbose = True
wbe.max_procs = -1
wbe.working_directory = os.path.normpath(r"/mnt/fd/FilipeTrabalho/VA/bar_proj")
vector_1 = wbe.read_vector('anjos.shp')
outputVector = wbe.clean_vector(vector_1)
wbe.write_vector(outputVector, '/tmp/processing_dMmsyH/0b7d300b0bf148d596923e3c67a3cb3c/fnOutput.gpkg')

Process completed successfully.
Execution completed in 0.04 seconds
Results:

Loading resulting layers
The following layers were not correctly generated.
• /tmp/processing_dMmsyH/0b7d300b0bf148d596923e3c67a3cb3c/fnOutput.gpkg
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
QGIS version: 3.36.0-Maidenhead
QGIS code revision: 5bb9993d97a
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)
Algorithm started at: 2024-03-01T08:53:47
Algorithm 'Clean vector' starting…
Input parameters:
{ 'fnOutput' : 'TEMPORARY_OUTPUT', 'input1' : '/mnt/fd/FilipeTrabalho/VA/bar_proj/arroios.shp' }

WbW Script:
import os, sys
path = os.path.normpath(r"/home/fd/.local/share/QGIS/QGIS3/profiles/default/python/plugins/whitebox_workflows_for_qgis")
if path not in sys.path:
sys.path.append(path)

from whitebox_workflows import WbEnvironment
wbe = WbEnvironment()
wbe.verbose = True
wbe.max_procs = -1
wbe.working_directory = os.path.normpath(r"/mnt/fd/FilipeTrabalho/VA/bar_proj")
vector_1 = wbe.read_vector('arroios.shp')
outputVector = wbe.clean_vector(vector_1)
wbe.write_vector(outputVector, '/tmp/processing_dMmsyH/e48df16983e443bda87d19f0f763b044/fnOutput.gpkg')

Process completed successfully.
Execution completed in 0.04 seconds
Results:

Loading resulting layers
The following layers were not correctly generated.
• /tmp/processing_dMmsyH/e48df16983e443bda87d19f0f763b044/fnOutput.gpkg
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
jblindsay commented 7 months ago

Hi @fsdias I don't think this is an issue with the use of the temporary file per se, but rather because QGIS is defaulting to a gpkg file format for that file's vector file format. The GeoPackage is not a supported vector format for Whitebox. In honestly, I don't know what I can do about that. I don't know why QGIS defaults to the GeoPackage but ultimately I can't see a way to resolve that issue with temporary files.

fsdias commented 7 months ago

I'm quite sure there's a solution. I suggest asking that question here: https://lists.osgeo.org/mailman/listinfo/qgis-developer