[gdal-dev] Having a problem getting VRT ComplexSource to Scale

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Thu Jan 23 17:20:16 PST 2020

Hi all,

I'm having trouble getting my VRT file to scale the source data into my 
I've been looking at this https://gdal.org/drivers/raster/vrt.html

The source GeoTiff has:

Band 1 Block=4500x1 Type=Float32, ColorInterp=Gray
   Minimum=1.082, Maximum=46.322, Mean=34.181, StdDev=2.049
   NoData Value=-30000
   Overviews: 2250x2126, 1125x1063, 563x532, 282x266, 141x133, 71x67

My goal is to scale the source 0-50 into 10-240 in the ColorTable.

The VRT looks like:

<VRTDataset rasterXSize="4500" rasterYSize="4251">
   <GeoTransform> -180.0 ,0.08 , 0 , 90.0 , 0 , -0.04 </GeoTransform>
   <VRTRasterBand dataType="Byte" band="1">
       <Entry c1="0" c2="0" c3="0" c4="255"/>
       <Entry c1="0" c2="0" c3="255" c4="255"/>
       <Entry c1="255" c2="255" c3="255" c4="255"/>
       <SrcRect xOff="0" yOff="0" xSize="4500" ySize="4251"/>
       <DstRect xOff="0" yOff="0" xSize="4500" ySize="4251"/>

50 - 0 = 50
240 - 10 = 230
230 / 50 = 4.6 = ScaleRatio
10 = ScaleRatio

I've tried a lot of other value trying to play with the scaling.

I also tried using:


<DstMax>240</DstMax> but that doesn't appear to work either. Using: GDAL 2.2.3, 
released 2017/11/20 on Unbuntu 18.04 My conclusion is that I'm not 
understanding the meaning of these fields or these are meant for 
something other than my goal. Any help would be appreciated. Thanks, -Steve

More information about the gdal-dev mailing list