I am new to GIS and I want to do Suitability Analysis for Landfill Site Selection in QGIS. I had a Land-Use map in jpeg format, from which I started by making shapefiles of each kind of input layer such as commercial areas, settlements, agriculture, roads, water bodies etc. Now, I am having problems in rasterizing these shapefiles. I have not yet created any fields in the attribute table as I do not know exactly what is the role of fields in rasterizing. I tried to rasterize by using Raster menu> Conversion> Rasterize. but it produced just a black rectangular layer with nothing on it. Here are the Screenshots of one of the shapefiles and the raster that got created by following above method-
You need at least one field with a number in the shapefile you want to rasterize. In the process of rasterizing, a value is written in every cell that represents your shape. This value has to come from your attribute table. If you just want a simple
1 raster as a result, then just add a row with the value
1 in the attribute table of the file you want to rasterize.
You do this by opening the attribute table and clicking the field calculator. Then select
New field, enter a name for the field like
integer as field type and enter the number
1 in the expression window below. Click ok.
Now, when you use the
Rasterize Tool, choose the attribute field
rast_val. Select the other settings as you wish and click ok. Now it should work as expected.
I was having the same problem with the result being an all black file. In Properties for the layer, i noticed under Style then Band Rendering that the min value was NaN and max was 0. I edited both values, min to 0 and max to 1. Also, i changed color gradient to white to black. now i can see my layer properly.