Skip to main content
2 of 2
improved code
mgri
  • 16.3k
  • 6
  • 48
  • 80

From the algorithm dialog you should see something like this:

enter image description here

which is a call from GDAL using Processing. So, I think it should be enough starting from it for creating your own script.

You may try using this code (you should edit the com_string string by adding your specific parameters, including the extra flags):

##Rasterize_GDAL_KRK=name
##Input=vector
##Output=output raster
##Extent=extent
##cellsize=number 25

import os, gdal
import processing


ex = Extent.split(',')
ext = str(ex[0]) + "," + str(ex[1]) + "," + str(ex[2]) + "," + str(ex[3])

com_string = "gdal_rasterize -a KRK_1 -ot 0 -of GTiff -te " +  ext + " -tr " + str(cellsize) +" " + str(cellsize) + " -co COMPRESS=NONE -co BIGTIFF=IF_NEEDED -l " + str(Input)
os.system(com_string)

As a first step, I suggest you to initially copy-and-paste only what you see in the Processing dialog after having set your input parameters, and then trying to add your extra flags in the code.

mgri
  • 16.3k
  • 6
  • 48
  • 80