QGIS-Documentation icon indicating copy to clipboard operation
QGIS-Documentation copied to clipboard

Rasterisation gives nodata values for 0

Open dlejay opened this issue 2 years ago • 4 comments

Description

The Rasterise operation does not immediately give back the all_conditions_simple raster. Indeed the value 0 is understood as nodata and is displayed as such. In order to really get the same raster, displayed in the same way, I had to deselect No data value in the Transparency tab and I had to change the min of the gray band to 0 instead of 1.

Why is 0 in the vector layer translated to nodata ?

Page URL: https://docs.qgis.org/3.28/en/docs/training_manual/complete_analysis/raster_to_vector.html#moderate-fa-the-raster-to-vector-tool

dlejay avatar May 30 '23 12:05 dlejay

I have the answer to my question : the way the tutorial is set, the value 0.00000 is automatically given to GDAL as a nodata value. So one needs to remove it before run.

dlejay avatar May 30 '23 12:05 dlejay

@dlejay Mind sharing your all_conditions_simple.tif layer you obtained, please? I'd like to update the page (and address this issue) but no time to go through the whole process of previous lessons. Thanks in advance.

DelazJ avatar May 30 '23 20:05 DelazJ

I can't upload a .tif directly on Github, so here is a .png instead

The following raster is what I obtain after :

  • Using the GDAL aspect algorithm with a flat default value of 0° (contrarily to what the tutorial currently asks) ;
  • Using the rest of the conditions of the tutorial
((aspect@1 <= 90 OR  aspect@1 >= 270) AND slope@1 <= 5) OR slope@1 <= 2
  • Using the GDAL sieve algorithm with an 8 threshold and 8-connectedness (as demanded by the tutorial).

all_conditions_simple

dlejay avatar May 31 '23 08:05 dlejay

I can't upload a .tif directly on Github

Maybe within a zip file? Or you meant it is too heavy? I'm trying to use the PNG. Applying the polygonize algorithm to it, I get a vector file that is the symmetric output 😢 . If someone knows how to fix/workaround...
image

DelazJ avatar Jun 01 '23 10:06 DelazJ