[gdal-dev] Is it possible to use VRTDerivedRasterBand in VRTWarpedDataset?

Next Stop nextstopsun at gmail.com
Thu Oct 8 05:03:54 PDT 2020


Hello,

I have two-band raster dataset, which I need to warp to another CRS, calculate a single band with a pixel function and apply a color lookup table to it, so the result is interpolated RGB color.

The result can be achieved by calling `gdalwarp` then `gdal_calc.py` and then `gdaldem color-relief` with a color LUT. 

But I don't need any intermediate data. So I'm lookig for a way to define the whole workflow in a single VRT. 
Is that possible?


So far I've created a VRTWarpedDataset, but when I try to reduce the number of bands to a single VRTDerivedRasterBand, I get an error:

```
ERROR 5: panDstBands[1] = 2 ... out of range for dataset.
```

When leaving second band, I get 
```
Warning 1: Unable to export color table to GeoTIFF file.  Color tables can only be written to 1 band or 2 bands Byte or UInt16 GeoTIFF files.
```

Also just adding a color table doesn't output 3-band RGB with color interpolation like `gdaldem color-relief`. 
Can such interpolation be set up in VRT?


More information about the gdal-dev mailing list