I try to create a raster layer from a line shape on canvas.

This raster layer band values should be equal and different from other cells. For instance the cells which consists line should be 0 other sides should be 1 - of course other side values should be equal, as well.

There is a tool which helps me about it?

enter image description here


Have a look to processing and gdal.

Using QGIS 2.18


There is for your purpose one algorithm that fits well : gdal rasterize. You can use it as follow:

import processing


for the many option see processing.alghelp("gdalogr:rasterize") in your console.

Using QGIS 3.0

Same principle with processing.run... You may want to have a look here : Using processing.runalg in QGIS 3

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.