I have a vector layer which i am trying to rasterize. It is smaller than the study area. The end goal is to create a layer with euclidean distance from said rasterized vector layer.

When rasterizing, I use another raster layer covering the whole study area for the output extent. I think this should give me the value 1 for "presence" of my vector and 0 for "absence" in the respective locations. However, I get the value 1 for all cells in my raster layer but the color is differentiated according to the vector i rasterized. The black pixels form the correct shape but the surrounding transparent pixels have the same value.

How do I get this raster with the transparent pixels set to 0?

I followed the answer to this question: Calculating distance to points in QGIS and added a new column to my attribute table which i populated with 1 before rasterizing. I used this field as my "field to use for burn-in value". I believe this might be where my mistake stems from but if I leave that field empty i get a completely empty raster layer with values that don't make sense (see layer "Rasterized" in screenshot).

I also tried to set the accuracy in the layer styling panel to actual but to no avail.

study area with raster layer over top, only the raster layer with the values 1 and 1 for black and transparent acutally appears, black is shape of rasterized vector layer


Delete the fixed value for burn-in and use a value from a field. Then you'll get different raster values for different polygons. Use ID or some other field that you have in your polygons, eg 1 for land, 2 for water, etc.


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.