[gdal-dev] Use gdal_rasterize for two different layers with two different channels

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Sun Nov 18 00:31:23 PST 2018


Hi,

Create the raster to have as many bands as you will need and burn the first
set as red

... -burn 255 -burn 0 -burn 0 -ot byte ...

Then paint more features with reen  color to existing raster

... -b 1 -b 2 -b 3 -burn 0 -burn 255 -burn 255 ...

These parameters overwrite red and blue bands to zero and the result is
certainly green. If the data matters and you want to keep the existing
values on other bands then burn just the green band

... -b 2 -burn 255

Now the pixels which have overlap with the previous red geometries will have
RGB values (255 255 0) and appear yellow. 
The examples in https://www.gdal.org/gdal_rasterize.html try to cover this
use case but they may not be most clear.

-Jukka Rahkonen-




Oliver Rausch wrote
> Hi all,
> I have two tables of geometries that I'd like to rasterize onto one
> output. I can rasterize the tables individually using
> 
> gdal_rasterize -burn 255 -sql "SELECT way FROM lines" PG:'...' -te ...
> -ts ... out.tif
> 
> Is there a way to get a raster where, for instance all the lines from
> one table are on the red channel, and all the lines from the second
> table are on the blue channel?
> 
> Thanks,
> Oliver .
> _______________________________________________
> gdal-dev mailing list

> gdal-dev at .osgeo

> https://lists.osgeo.org/mailman/listinfo/gdal-dev





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list