I got a river vector file. I want to rasterize it so that the river is 2 pixels wide. How do I achieve that in QGIS 3.2.3?

When I try to use vector to raster, I get this and no file is created:

Algorithm 'Rasterize (vector to raster)' starting…
Input parameters:
{ 'BURN' : 0, 'DATA_TYPE' : 5, 'EXTENT' : '413885.10813709395,678750.4296324956,6754403.012272906,6909638.055526119 [EPSG:32635]', 'FIELD' : None, 'HEIGHT' : 0, 'INIT' : 0, 'INPUT' : 'C:\\Users\\vvaris\\Desktop\\Uoma\\Uoma10.shp', 'INVERT' : False, 'NODATA' : 0, 'OPTIONS' : '', 'OUTPUT' : 'C:/Users/vvaris/Desktop/asd.tif', 'UNITS' : 0, 'WIDTH' : 0 }

GDAL command:

gdal_rasterize -l Uoma10 -burn 0.0 -ts 0.0 0.0 -a_nodata 0.0 -te 413885.10813709395 6754403.012272906 678750.4296324956 6909638.055526119 -ot Float32 -of GTiff C:\Users\vvaris\Desktop\Uoma\Uoma10.shp C:/Users/vvaris/Desktop/asd.tif

GDAL command output:

ERROR 1: Wrong value for -outsize parameter.


gdal_rasterize [-b band]* [-i] [-at]

{[-burn value]* | [-a attribute_name] | [-3d]} [-add]

[-l layername]* [-where expression] [-sql select_statement]

[-dialect dialect] [-of format] [-a_srs srs_def]

[-co "NAME=VALUE"]* [-a_nodata value] [-init value]*

[-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]

[-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/

CInt16/CInt32/CFloat32/CFloat64}] [-q]

<src_datasource> <dst_filename>

Execution completed in 0.13 seconds


{'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':C:/Users/vvaris/Desktop/asd.tif, 'createOptions': {'fileEncoding': 'System'}}>}

Loading resulting layers
Algorithm 'Rasterize (vector to raster)' finished
  • You need to select a different outsize parameter, units and width are set up as 0 – Roberto Zeeland Sep 21 '18 at 8:25
  • It didn't help. All I get is empty folder. – vvaris Sep 21 '18 at 8:41
  • Initially you got the error ERROR 1: Wrong value for -outsize parameter. Do you get the same error again? If that's the case have a look here as it might be describing the same error you are getting. – Roberto Zeeland Sep 21 '18 at 8:44
  • I don't get it, I either got nothing or black square. "OUTPUT' : 'C:/Users/vvaris/Desktop/asd.tif', 'UNITS' : 0, 'WIDTH' : 2 " UNITS is still zero for some reason... – vvaris Sep 21 '18 at 9:01
  • 1
    It created a "rasterised" layer, under it there reads Min: 1.79769e+308 Max -1.79769e+308. How do I check if my shapefile is projected? – vvaris Sep 21 '18 at 9:38

You need to know the width of the river. Once you know that, just use Convert vector to raster and select a cell size half the width of the river. enter image description here

enter image description here

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.