-1

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

1

Have a look to processing and gdal.

Using QGIS 2.18

https://docs.qgis.org/2.18/fr/docs/user_manual/processing/console.html

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

import processing

processing.runalg("gdalogr:rasterize","path/to/your/vector/layer.shp","area",1,100,100,"869423.623626,934698.45436,6310430.7313,6345492.27874",False,5,"",4,75,6,1,False,0,"",None)

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.