2

I'm trying to polygonize a raster layer which has decimal values. I have to assume polygonize rounds the decimal values up or down to the nearest integer since it appears to dissolves cells with different decimal values (but same leading value) into the same polygon feature.

In that case, is there a way of converting each unique value (decimals inclusive) into a new integer ID, in raster calculator.

For example, all cells of 1.22 become 23, all cells of 1.24 become 24, etc.

2 Answers 2

4

What you can do is just use those numbers as ID's, depending on your purpose, or round them. If you don't want to give up on those decimals, what you can do is to multiply the raster by 1000 (or 100 in your case). That gives you an int raster with all the values.

enter image description here

Then, just use polygonize...

enter image description here

4

Use the QGIS Raster Pixels to Polygons tool instead of the GDAL Polygonize (raster to vector) tool.

Raster Pixels to Polygons converts floating point values while Polygonize only supports integer values.

You may need to dissolve afterwards, the tool converts pixels individually instead of grouping pixels of the same value into a single polygon.

enter image description here

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.