1

I have 4 channel rasters in GeoTIFF.

enter image description here enter image description here

I need to find the average value of these rasters and present them in the form of another raster, also in RGB, and I get a black and white file.

enter image description here

How can I get rid of this?

 gdal_calc.py -A /var/www/html/algorithm/cut103.tif -B /var/www/html/algorithm/cut1031.tif  --outfile=result.tif --calc="(A+B)/2"[![Вот что получается.][1]][1]

I also tried to use gdal_translate -of VRT input.tif input.vrt

My input.vrt:

<ColorInterp>Palette</ColorInterp>
<ColorTable>
    <Entry c1="170" c2="170" c3="255"/>
    <Entry c1="85" c2="170" c3="255"/>
    <Entry c1="66" c2="33" c3="18"/>
    <Entry c1="159" c2="81" c3="42"/>
    <Entry c1="205" c2="169" c3="21"/>
    <Entry c1="253" c2="254" c3="3"/>
    <Entry c1="230" c2="236" c3="6"/>
    <Entry c1="208" c2="223" c3="0"/>
    <Entry c1="185" c2="207" c3="2"/>
    <Entry c1="162" c2="192" c3="0"/>
    <Entry c1="138" c2="175" c3="0"/>
    <Entry c1="114" c2="160" c3="0"/>
    <Entry c1="91" c2="142" c3="3"/>
    <Entry c1="69" c2="129" c3="0"/>
    <Entry c1="45" c2="112" c3="0"/>
    <Entry c1="37" c2="96" c3="45"/>
    <Entry c1="21" c2="84" c3="45"/>
    <Entry c1="21" c2="68" c3="45"/>

Plese? someone, help

7
  • 3
    Konstantin, this site allows communication only in English. I suggest using a google translator and editing the question. Константин, на данном сайте разрешено общение только на английском языке. Предлагаю воспользоваться переводчиком и отредактировать вопрос. – Comrade Che Mar 10 at 6:36
  • @ComradeChe, translate done. – Константин Mar 11 at 6:04
  • What software is used to display the resulting image? Are the pixel values really zero (black), 255 (white), or is this an image display (render) issue? – Comrade Che Mar 11 at 6:33
  • @ComradeChe, i use QGis, pixels valuses realy zero, i dont created an alpha channel. – Константин Mar 11 at 6:47
  • @ComradeChe, i have added images as examples – Константин Mar 11 at 9:22
0

You have to specify band for each file before calculations (see --A_band parameter in gdal_calc) then use gdal_merge to merge 3 gdal_calc outputs into RGB raster.

2
  • Thank you so much. You helped me a lot. – Константин Mar 15 at 10:14
  • When working with two rasters, everything turns out fine, but with an increase in the number of processed rasters, it again produces a black and white result – Константин Mar 17 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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