1

I tried to convert a polygon shapefile of classified land cover to raster using 'Rasterize (vector to raster) tool in GDAL. I chose the DN field, set output ratser size unit to pixels and chose the same layer extent as output extent. I get the following error:

GDAL command output:
*ERROR 1: Wrong value for -ts 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>**

What should I change to rasterize this polygon?

enter image description here

  • 1
    According to your error message you set no extent ([-te ...]) and no resolution ([-ts ...]). – Erik Jan 14 at 11:09
  • Thanks @Erik, but I did set the extent. I attach a screenshot. For resolution, I do not know what I should I choose – Paris Jan 14 at 11:33
  • 2
    Then simply try some resolutions? – Erik Jan 14 at 11:41
  • I tried different valuse but the shapefile is so big and it takes over 1 hour to complete and I did not know on what base it should be – Paris Jan 14 at 11:44
  • 3
    You have selected output size units to be in pixels. Width and height are left to zeroes. Zero by zero sized image is nothing. For example 1000 by 1000 pixel sized image would be something. – user30184 Jan 14 at 11:51
1

I created an arbitrary shapefile approximately in your extent area as follows.

enter image description here

In 'Rasterize (vector to raster)' tool I used following parameters.

enter image description here

After click in Run, features polygon were rasterized as expected (burn field class and resolution 0.1x0.1 degrees).

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.