5

I am using gdal_rasterize to create a raster of a huge file containing polygons. I managed to generate the raster file with the right color and with the minimum size to tile it after with the gdal2tile.

gdal_rasterize -of GTiff -co COMPRESS=DEFLATE 
-b 1 -b 2 -b 3 -burn 136-burn 46 -burn 17
-co PREDICTOR=2 
-co ZLEVEL=9
-ot Byte 
-a_nodata 255 
-a Niveau 
-ts 500000 500000 
-l layer W:/layer.shp
W:/layer.tif

Tile will be used to overlay Google Maps so the polygon must be transparent.

Has anybody experimented with this usage of gdal_rasterize and succeeded in setting the opacity of the output raster?

1 Answer 1

7

Sorry for the short answer but I suppose that simply adding an alpha channel might do the trick. At least I could make an output that is semi-transparent in QGIS with the following command.

gdal_rasterize -of gtiff
-ot byte  
-co alpha=yes 
-burn 255 -burn 0 -burn 0 -burn 100 
-ts 500 500 
-l test test.shp test.tif
1
  • Think you it work
    – AhmeX2
    Commented Jan 12, 2016 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.