Raster to Vector GDAL raster conversion error QGIS 3.28

gdalpolygonizeqgis-3raster-conversionvector

I'm trying to convert a raster layer with values 1 to 0 in vector layer using GDAL raster conversion – Polygonize (Raster to Vector) in QGIS 3.28.
After processing i got an error at the Log window:

GDAL command:
gdal_polygonize.bat %3Fcrs%3DEPSG%3A4326%26extent%3D22.14523000000000152%2C38.27817999999999898%2C22.56270999999999916%2C39.11314000000000135%26width%3D1181%26height%3D2362%26formula%3D%2522222%402%2522%253C160%26222%3Auri%3DC%3A%255CUsers%255CUser%255CDesktop%255Cgeology%2520prova%255Craster%2520prova%255C222.jpeg%26222%3Aprovider%3Dgdal -b 1 -f "GPKG" C:/Users/User/AppData/Local/Temp/processing_hQdayx/bf22508f974243a8bbbb8a9b2e6a4dc9/OUTPUT.gpkg OUTPUT DN
GDAL command output:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS32~1.9\apps\Python39\lib\site-packages\osgeo_utils\auxiliary\gdal_argparse.py", line 175, in main
self.doit(**kwargs)
File "C:\PROGRA~1\QGIS32~1.9\apps\Python39\lib\site-packages\osgeo_utils\gdal_polygonize.py", line 314, in doit
return gdal_polygonize(**kwargs)
File "C:\PROGRA~1\QGIS32~1.9\apps\Python39\lib\site-packages\osgeo_utils\gdal_polygonize.py", line 75, in gdal_polygonize
src_ds = gdal.Open(src_filename)
File "C:\PROGRA~1\QGIS32~1.9\apps\Python39\lib\site-packages\osgeo\gdal.py", line 5337, in Open
return _gdal.Open(*args)
RuntimeError: `%3Fcrs%3DEPSG%3A4326%26extent%3D22.14523000000000152%2C38.27817999999999898%2C22.56270999999999916%2C39.11314000000000135%26width%3D1181%26height%3D2362%26formula%3D%2522222%402%2522%253C160%26222%3Auri%3DC%3A%255CUsers%255CUser%255CDesktop%255Cgeology%2520prova%255Craster%2520prova%255C222.jpeg%26222%3Aprovider%3Dgdal' does not exist in the file system, and is not recognized as a supported dataset name.
Process returned error code 1
Execution completed in 0.51 seconds
Results:
{'OUTPUT': 'C:/Users/User/AppData/Local/Temp/processing_hQdayx/bf22508f974243a8bbbb8a9b2e6a4dc9/OUTPUT.gpkg'}

Loading resulting layers
The following layers were not correctly generated.
• C:/Users/User/AppData/Local/Temp/processing_hQdayx/bf22508f974243a8bbbb8a9b2e6a4dc9/OUTPUT.gpkg
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

enter image description here

enter image description here

How to solve this?

Best Answer

The problem was related to the source dataset that was created on-the-fly with the raster calculator tool. The Raster to Vector tool that runs gdal_polygonize on the background could not access the temporary raster layer that was created by the formula. The solution was to "materialize" the raster layer by saving it into a file for further processing with Raster to Vector.

Related Question