I'm trying to rasterize a polygon layer which has two columns : id and code. I would like each polygon to get value according to the code field.

I have used the tool rasterize from the raster menu

enter image description here

but it keeps failing with the next error message:

Loading resulting layers The following layers were not correctly generated.

  • C:/Users/hello/this/is/Tmy/processing/fmoreNumbers/OUTPUT.tif
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

why is it failing all the time? what can be the problem? and can I rasterize also based on categorical values?

Edit: log message:

Algorithm 'Rasterize (vector to raster)' starting… Input parameters: { 'BURN' : 0, 'DATA_TYPE' : 5, 'EXTENT' : '810660.0,844250.0,8123830.0,8145680.0 [EPSG:32721]', 'FIELD' : 'class', 'HEIGHT' : 0, 'INIT' : None, 'INPUT' : 'MultiPolygon?crs=EPSG:4326&field=Plot:string(254,0)&field=Crop:string(254,0)&field=Start:string(254,0)&field=End:string(254,0)&field=Grower:string(254,0)&field=Group:string(254,0)&field=Region:string(254,0)&field=Area%2C%20ha:double(23,15)&field=Season%20yea:string(254,0)&field=Code:string(254,0)&field=class:long(10,0)&uid={8ab7aaf2-0e7c-47f2-82d6-dd2abdb6d30c}', 'INVERT' : False, 'NODATA' : 0, 'OPTIONS' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'UNITS' : 0, 'WIDTH' : 0 }

GDAL command: gdal_rasterize -l INPUT -a class -ts 0.0 0.0 -a_nodata 0.0 -te 810660.0 8123830.0 844250.0 8145680.0 -ot Float32 -of GTiff C:/my/path/INPUT.shp C:]my/path/OUTPUT.tif GDAL command output: ERROR 1: Wrong value for -outsize parameter.

Usage: 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] [-to "NAME=VALUE"]*

[-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}] [-optim {[AUTO]/VECTOR/RASTER}] [-q]

<src_datasource> <dst_filename>

Execution completed in 0.33 seconds

  • What does the log file show – Ian Turton Jun 28 at 15:07
  • @IanTurton sorry, just added it now – Reut Jun 28 at 15:11
  • So the issue is "Wrong value for -outsize parameter." – Ian Turton Jun 28 at 15:32
  • 1
    Set width and height – BERA Jun 28 at 16:24
  • 1
    Your width/height = 0.0, that's not going to work. – user2856 Jun 28 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.