I want to use gdal_rasterize
to generate a TIFF from a .shp
shapefile. Usually the result is big, so I want to compress it using the LZW compress option.
I tried to do so with the command
gdal_rasterize.exe -burn 255 -burn 255 -burn 0 -burn 255 -ot Byte -tr 0.0332147 0.0332147 shp.shp shp0.tif --config COMPRESS LZW
but it seems the --config COMPRESS LZW
option doesn't have any effect. (The result is exactly the same size as without the option.)
Maybe I have some misunderstanding of how to use this option.
You should add an =
symbol between the option and the value. Without your data i cant test your specific example, but for me this fails:
gdal_translate --config COMPRESS LZW infile.tif outfile.tif
and this works fine:
gdal_translate --config COMPRESS=LZW infile.tif outfile.tif
You can also write the --config
as -co
, and wrapping it with quotes also works, which is how i usually do it.
gdal_translate -co "COMPRESS=LZW" infile.tif outfile.tif