<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Helvetica Neue";
panose-1:2 0 5 3 0 0 0 2 0 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">I came across some strange behavior while panning around a VRT in QGIS. The VRT consists of several large overlapping TIFs where some TIFs have NODATA in areas where other TIFs have data. The behavior is hard
to explain, but it looks like the data read from the files is corrupted. Panning around, zooming in and out, anything that triggers another read seems to change the way the data looks. It changes colors, gets skewed, etc. The TIFs themselves are fine on their
own.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I have reduced it down to a small subset of the data which is available here (about 2 MB):<o:p></o:p></span></p>
<p class="MsoNormal"><a href="https://s3.amazonaws.com/pschmitt-test-public/data.tar.bz2"><span style="font-size:10.5pt;font-family:"Helvetica Neue";color:#329AD6;background:white;text-decoration:none">https://s3.amazonaws.com/pschmitt-test-public/data.tar.bz2</span></a><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">It consists of two TIFs:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">1.tif - fully valid<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">2.tif - some valid data and some NODATA<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I also included three VRTs which I created with these commands:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">gdalbuildvrt -r near near.vrt 1.tif 2.tif<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">gdalbuildvrt -r bilinear bilinear.vrt 1.tif 2.tif<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">gdalbuildvrt -r bilinear bilinear-reversed.vrt 2.tif 1.tif<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">If I run this command repeatedly, the min/max of the 4 bands always come out the same:
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">gdal_translate -projwin 488135 4405500 488374 4405348 near.vrt /vsistdout/ | gdalinfo -mm /vsistdin/<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Run this same command on bilinear.vrt, and the min/max change each time. So that's weird.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Run the command on bilinear-reversed.vrt and the min/max are stable just like nearest neighbor resampling. So it seems like it depends on the stacking order of the data, and whatever is going on here doesn't
happen with the default resampling. I also tried cubic and it seemed to happen there as well.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I've seen this behavior with GDAL 2.4.0 and also with the current master, commit dc117d571250d7e2442cb003f3dc541114f52766.<o:p></o:p></span></p>
</div>
<br>
This electronic communication and any attachments may contain confidential and proprietary information of DigitalGlobe, Inc. If you are not the intended recipient, or an agent or employee responsible for delivering this communication to the intended recipient,
or if you have received this communication in error, please do not print, copy, retransmit, disseminate or otherwise use the information. Please indicate to the sender that you have received this communication in error, and delete the copy you received.
<br>
<br>
DigitalGlobe reserves the right to monitor any electronic communication sent or received by its employees, agents or representatives.
</body>
</html>