2

I try to vectorize raster layer. Each pixel has value from 1 to 128. It the simplest and has only 1 band.

enter image description here

I use polygonize tool and I get an error. enter image description here

Initially I got my raster from rasterize tool (maybe it matters). I saved it on a disk, but it also doesn't work.

How can I do this? I'm new in QGIS and I've hardly worked with raster layers.

4
  • By the error message there is some problem with creating the output layer. I suppose that you used the "GDAL Polygonize (Raster to Vector)" tool. What do you see in the "GDAL/OGR console call" box?
    – user30184
    Feb 25 at 17:08
  • Hello! I don't know how to see GDAL/OGR console call box. I'm using upper menu: Raster - Conversion - Polygonize. I noticed that if the output layer is not temporary, then there is no error. But I want to implement polygonization through PyQGIS and saving is not very suitable for me. Is it normal that I have to save it to disk?
    – grassu
    Feb 25 at 17:51
  • 1
    Have you scrolled down in the parameters window? "Save to temporary file" is the default and it should work. However, I got the same error than you. The reason for the error is earlier in the log: Creating output ... Local/Temp/processing_itbYJS/f14705232a734c5786af2c76250a18d6/OUTPUT.xtf of format Interlis 2. It means that QGIS selects a file format that is not suitable for the task. Please write mail to qgis-users list and ask if this bug is already found. The QGIS tools saves the result into a temp file but with Python it should be possible to use gdal.org/drivers/raster/mem.html.
    – user30184
    Feb 25 at 19:30
  • 1
    Please include error messages as text. Images are not legible on all devices, and cannot be searched by others with the same problem.
    – Vince
    Feb 25 at 23:26

1 Answer 1

4

I could re-produce the error with QGIS 3.35, installed with OSGeo4W.

The command log shows that with the default setting QGIS tries to save the polygonozed result into an Interlis 2 file. This format obviously does not support a method that is called "CreateLayer", and the process fails.

Creating output ... Local/Temp/processing_itbYJS/f14705232a734c5786af2c76250a18d6/OUTPUT.xtf of format Interlis 2

As a workaround is is possible to de-activate this driver from the settings Options - GDAL - Vector drivers.

enter image description here

After restarting QGIS without Interlis drivers it decided to use GeoPackage as the storage format for the temporary layer.

gdal_polygonize.bat test.tif -b 1 -f "GPKG" ... Temp/processing_pIiZIV/a80ec29dc5ba435bb8d1b22d7796e291/OUTPUT.gpkg OUTPUT DN
1
  • Thank you for help!
    – grassu
    Feb 27 at 13:29

Your Answer

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

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