QGIS Raster Calculator – Assign Unique Integer ID to Values

integerqgisrasterraster-calculator

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.

Best Answer

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

Related Question