I am trying to convert a raster layer to a polygon layer using QGIS 3.16. 2. When I open the polygonize tool, the program does not allow me to select any existing raster layers from the 'Input layer' drop-down menu.

I have tried manually selecting the raster from my computer (a .TIF tile), but just get the following message:

Dialog box

The Log Messages window does't seem to offer any further information, at least in the OGR tab, reading:

2021-01-16T11:42:49     WARNING    Cannot open C:/Users/User/Desktop/GBG_slope.tif.()

I am not sure what's happening here. What potential ways can I solve this issue?

  • 1
    Aren't you trying Polygonize under the Vector geometry? Try Polygonize (raster to vector) under the GDAL > Raster conversion instead. – Kazuhito Jan 16 at 10:59
  • Polygonize (raster to vector) creates a series of pixel polygons. I could be misremembering, but I thought Polygonize could create "smoother" polygons. The files when using Polygonize (raster to vector) are also very large, since every single pixel becomes a polygon. – jserv Jan 16 at 11:09
  • @Kazuhito, you are correct. Polygonize (raster to vector) is the tool I was looking for. I have also discovered that there is a Raster pixels to polygons option which works quite a bit faster than the GDAL alternative. For future reference, Polygonize (raster to vector) and Raster pixels to polygons appear to perform similar functions. Polygonize is a separate tool entirely, it seems. If you post as an answer, I will mark it as resolved. – jserv Jan 16 at 11:45
  • 1
    Raster pixels to polygons converts each pixel into a small polygon. Polygonize (raster to vector) also merges adjacent polygons which have the same value as the pixel value attribute into larger polygons. – user30184 Jan 16 at 12:26

When you search for Polygonize in the Processing Toolbox, there appear several tools.

enter image description here

1) Polygonize tool converts line layer to polygon layer, turning an area inside three line segments into a polygon. This tool takes line vector layers as input.

enter image description here

2) Polygonize (raster to vector) converts raster into vector polygons. If adjacent pixels have same value, they are grouped into the same polygon.

enter image description here

**3) Raster pixels to polygons** creates a rectangle polygon for each raster pixel. Similar tool Raster pixels to points creates a centroid point for each raster pixel.

enter image description here

So the tool you need would probably be Polygonize (raster to vector). However, you would better reclassify your raster into reasonable number of classes before doing Polygonize operation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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