Closed nilufer666 closed 2 months ago
I have tested with QGIS version: 3.22.8-Białowieża, I get the same error
I've just released a new version of the QGIS WbW frontend that should resolve many of the issues you encountered. Ultimately, this goes back to the use of the backslash by Windows as a file separator character. I don't really use Windows and so this issue went unnoticed until you pointed it out. The new version (v1.2.3) in the queue awaiting approval, which normally takes a few days. There is one more concern that I have though, with the printout that you posted above, specifically this line:
vector_2 = wbe.read_vector('MultiPolygon?crs=EPSG:31287&field=HYDROID:long(10,0)&field=HZBCODE:string(21,0)&field=ABSCHNITT:string(254,0)&field=FLAECHEKM2:double(18,11)&field=GEWAESSER:string(100,0)&field=FGE:string(59,0)&field=HZBFG:string(254,0)&field=VERSION:string(5,0)&field=_count:double(0,0)&field=_mean:double(0,0)&field=_min:double(0,0)&field=_max:double(0,0)&uid={e5fed0fc-5f7c-491c-ab5f-a9a62d02f60b}')
The read_vector
function takes in a string that represents a file path. This clearly is not that and will certainly cause issue.
Unfortunately, I still get error and it is still the backslash issue
I get the following error when I both set the output to 'save to temporary file' and 'save to file'
QGIS version: 3.34.4-Prizren
QGIS code revision: decd43dc
Qt version: 5.15.3
Python version: 3.9.18
GDAL version: 3.8.4
GEOS version: 3.12.1-CAPI-1.18.1
PROJ version: Rel. 9.3.1, December 1st, 2023
PDAL version: 2.6.0 (git-version: 3fced5)
Algorithm started at: 2024-04-05T09:03:47
Algorithm 'Fill depressions wang and liu' starting…
Input parameters:
{ 'dem1' : 'D:/_NC/workplace/datain/dem_clipped.tif', 'fix_flats2' : True, 'flat_increment3' : 0, 'fnOutput' : 'TEMPORARY_OUTPUT' }
WbW Script:
import os, sys
path = os.path.normpath(r"C:\Users/ncipa/AppData/Roaming/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"D:\_NC\workplace\datain")
raster_1 = wbe.read_raster(r"D:\_NC\workplace\datain\dem_clipped.tif")
outputRaster = wbe.fill_depressions_wang_and_liu(raster_1, True, 0.0)
wbe.write_raster(outputRaster, 'C:\Users\ncipa\AppData\Local\Temp\processing_dqXJxO\55a2114d1bb74225a4246fc0a392b2b1\fnOutput.tif', True)
File "<string>", line 13
wbe.write_raster(outputRaster, 'C:\Users\ncipa\AppData\Local\Temp\processing_dqXJxO\55a2114d1bb74225a4246fc0a392b2b1\fnOutput.tif', True)
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Process returned error code 1
Execution completed in 0.42 seconds
Results:
{'fnOutput': <QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {'fileEncoding': 'windows-1252'}}>}
Loading resulting layers
The following layers were not correctly generated.
• C:/Users/ncipa/AppData/Local/Temp/processing_dqXJxO/55a2114d1bb74225a4246fc0a392b2b1/fnOutput.tif
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
I appreciate you letting me know about the continued issue. I thought that I fixed all of them, but it seems that while I was focusing on the input file locations, I missed out on some of the output files. I'll have an update later this weekend and hopefully this finally resolves the Windows-based issues. At some point I'm going to have to purchase a Windows machine to do some proper testing on that OS. Anyhow, keep an eye out for v1.2.4, after it passes the approval process.
Meanwhile I was able to run the tool via python console in QGIS
# Run the processing algorithm
result = processing.run("wbw:fill_depressions_wang_and_liu", {
'dem1': r"C:\workspace\datain\wbw_demCLP.tif",
'fix_flats2': True,
'flat_increment3': 0,
'fnOutput': r"C:\workspace\datain\dem_clipped_2.tif"
})
# Get the result layer
result_layer = result['fnOutput']
# Add the result layer to the map canvas
QgsProject.instance().addMapLayer(result_layer)
Okay, the new version has finally been approved and is publicly available. If you could please test it to see if it resolves the issues that you encountered.
I upgraded it to v1.2.4 and unfortunately still get the same error
Same here, following. Get the same error when I try to save as temporary file. When trying to save at a specific location, get another error which seems to be kind of the same problem. Thank you !
QGIS version: 3.36.1-Maidenhead QGIS code revision: 3e589453 Qt version: 5.15.3 Python version: 3.9.18 GDAL version: 3.8.4 GEOS version: 3.12.1-CAPI-1.18.1 PROJ version: Rel. 9.3.1, December 1st, 2023 PDAL version: 2.6.0 (git-version: 3fced5) Algorithm started at: 2024-04-23T08:43:14 Algorithm 'Clean vector' starting… Input parameters: { 'fnOutput' : 'C:/temp/temp.gpkg', 'input1' : 'memory://Point?crs=EPSG:2950&uid={9679ecae-9f46-481d-8680-a313ad1b2985}&uid={28c3c9bb-3f71-46cd-ac7b-6a872b7f03eb}' }
WbW Script: import os, sys path = os.path.normpath(r"C:\Users/charles.gagnon/AppData/Roaming/QGIS/QGIS3\profiles\Charles Gagnon/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"C:\Users\charles.gagnon\OneDrive - Tetra Tech, Inc\Documents") vector_1 = wbe.read_vector(r"Point?crs=EPSG:2950&uid={9679ecae-9f46-481d-8680-a313ad1b2985}&uid={8a19665e-5b28-4e8d-adce-40475ef0fdce}") outputVector = wbe.clean_vector(vector_1) wbe.write_vector(outputVector, 'C:\temp\temp.gpkg')
thread 'Result::unwrap()
on an Err
value: Os { code: 123, kind: InvalidFilename, message: "La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte." }
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
Traceback (most recent call last):
File "Result::unwrap()
on an Err
value: Os { code: 123, kind: InvalidFilename, message: "La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte." }
Process returned error code 1
Execution completed in 0.18 seconds
Results:
Loading resulting layers The following layers were not correctly generated. • C:/temp/temp.gpkg You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
Hello. Just tried 1.25. Still get this :
Thank you !
QGIS version: 3.36.2-Maidenhead QGIS code revision: 6d250527 Qt version: 5.15.13 Python version: 3.12.3 GDAL version: 3.8.5 GEOS version: 3.12.1-CAPI-1.18.1 PROJ version: Rel. 9.4.0, March 1st, 2024 PDAL version: 2.6.3 (git-version: 816ce1) Algorithm started at: 2024-05-03T07:59:16 Algorithm 'Add point coordinates to table' starting… Input parameters: { 'fnOutput' : 'TEMPORARY_OUTPUT', 'input1' : 'memory://Point?crs=EPSG:2950&uid={2194878e-5e36-474d-90af-81e2367955e7}' }
WbW Script: import os, sys path = os.path.normpath(r"C:\Users/charles.gagnon/AppData/Roaming/QGIS/QGIS3\profiles\Charles Gagnon/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"C:\Users\charles.gagnon\OneDrive - Tetra Tech, Inc\Documents") vector_1 = wbe.read_vector(r"Point?crs=EPSG:2950&uid={2194878e-5e36-474d-90af-81e2367955e7}") outputVector = wbe.add_point_coordinates_to_table(vector_1) wbe.write_vector(outputVector, 'C:\Users\charles.gagnon\AppData\Local\Temp\processing_cbuUrp\f6d9bb4795fd48a190b5ca786e74ce05\fnOutput.gpkg')
File "
Loading resulting layers The following layers were not correctly generated. • C:/Users/charles.gagnon/AppData/Local/Temp/processing_cbuUrp/f6d9bb4795fd48a190b5ca786e74ce05/fnOutput.gpkg You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.
@CharlesGag Whitebox does not support gpkg (GeoPackage) files. The list of supported data file formats is provided here:
https://www.whiteboxgeo.com/manual/wbw-user-manual/book/read-writing-data.html
The issue is that you are using a temporary file output, which seems to be configured on your system to default to a gpkg file format. I'd suggest either changing that or specifying the output file yourself.
@jblindsay I don't think the problem lies only with GeoPackage. I am using the Surface Area Ratio Tool, and I am having a similar issue regardless of whether I choose a temporary file or a TIFF output.
@nilufer666 Thanks for reporting your issue. To confirm, are you using version 1.2.6 of the QGIS WbW plugin?
@jblindsay No, I was having 1.2.4! Just upgraded and works. Sorry!
@nilufer666 I'm very glad to hear that. Thanks for getting back to me.
Windows 10 QGIS 3.34.4 Whitebox Workflows for QGIS Version 1.2.2
When I run any tool and set the output to 'save to temporary file', I get the following error.
If I choose 'save to file', I also encounter another error.