<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Okay, thanks!</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So the interpretation we are aiming for is option <b>a)</b>:<br>
Each band is treated independently, and each one has its own NODATA value. The NODATA value of one band is unrelated to that of the others.</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
That said, the question is whether this behavior is consistently supported across all formats, or if it only works this way in our custom implementation.<br>
If not, perhaps the more robust approach would be to separate bands with different NODATA values into different subdatasets.</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
It’s possible that I’ve made a mistake in my implementation, but from what I’ve seen, formats like RST or GeoPackage don’t seem capable of handling this situation properly.</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In any case, I’ll end up implementing a function that determines how to group bands into datasets, and it will use the NODATA values to decide whether bands should be placed in the same subdataset or split into separate ones. </div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm looking forward to hearing your thoughts on what the best approach would be in a case like this.</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="margin-top: 1em; margin-bottom: 1em; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Abel.</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Even Rouault <even.rouault@spatialys.com><br>
<b>Enviat el:</b> dimecres, 21 de maig de 2025 16:55<br>
<b>Per a:</b> Abel Pau <a.pau@creaf.cat>; gdal-dev <gdal-dev@lists.osgeo.org><br>
<b>Tema:</b> Re: [gdal-dev] NODATA values in diferents bands in a DataSet</font>
<div> </div>
</div>
<div>
<p>Abel,</p>
<p><br>
</p>
<p>there is a subtelty:</p>
<p>a) If bands may have invalid pixels at different locations on different bands, and that those bands have a different nodata value, then using GDALRasterBand::SetNoDataValue() is the way to go.</p>
<p>b) If a given pixel is invalid only if its value on all bands matches the nodata value on each band, then NODATA_VALUES should be set instead<br>
</p>
<p><br>
</p>
<p>Example with 2 bands:</p>
<p>- Band 1, NoData=1,  pixel_1=1, pixel_2=1<br>
</p>
<p>- Band 2, NoData=2,  pixel_1=2, pixel_2=0</p>
<p><br>
</p>
<p>In interpretation a), then pixel_1 and pixel_2 are invalid for Band 1, and pixel_1 is invalid for Band 2</p>
<p>In interpretation b), then only pixel_1 is invalid (for both bands)<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="x_moz-cite-prefix">Le 21/05/2025 à 08:46, Abel Pau via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"><style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello,</div>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I am implementing a driver that allows different NODATA values for each band in a dataset.</div>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
>From what I understand in the documentation, I should use the <code>NODATA_VALUES</code> metadata item to document these values. However, I don't see a clear way to indicate that a specific band has
<b>no NODATA</b> value within the tuple.</div>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
On the other hand, the documentation also suggests that <code>NODATA_VALUES</code> is
<b>not widely honoured</b>, which is not very encouraging.</div>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
<span style="color:rgb(0,0,0)">Therefore, would you consider it good practice to separate bands with different NODATA values into separate
</span><span style="color:rgb(200,38,19)"><b>sub</b></span><span style="color:rgb(0,0,0)">datasets instead?</span></div>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thank you very much for the clarification.</div>
<div class="x_elementToProof" style="margin-top:1em; margin-bottom:1em; font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="x_Signature">
<table cellspacing="0" cellpadding="0" style="width:500px; box-sizing:border-box; border-collapse:collapse; border-spacing:0px">
<tbody>
<tr>
<td style="color:rgb(0,134,85); width:310px">
<div style="font-family:Arial; font-size:14px"><span style="color:rgb(0,134,85)"><b><a href="https://www.creaf.cat/en/about-us/our-people/abel-pau-garcia" target="_blank" id="x_profile_link" class="x_OWAAutoLink" style="color:rgb(0,134,85)">Abel Pau Garcia</a></b><a href="https://www.creaf.cat/en/about-us/our-people/abel-pau-garcia" target="_blank" id="x_profile_link" class="x_OWAAutoLink" style="color:rgb(0,134,85)">
</a></span></div>
</td>
<td rowspan="2" align="right" style="vertical-align:top; width:190px">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<a href="https://www.creaf.cat/" id="OWA4a7c9f16-ec4f-5320-4bf3-e8ccb18e01ce" class="x_OWAAutoLink" style="display:block; width:180px; height:43px"><img width="180" height="43" style="width:180px; height:43px" src="https://www.creaf.cat/sites/default/files/2024-10/logo-creaf-small.jpg">
</a></div>
</td>
</tr>
<tr>
<td style="padding-bottom:5px; color:rgb(188,88,2)">
<div style="font-family:Arial; font-size:13px"><span style="color:rgb(188,88,2)"><b><a href="https://www.creaf.cat/en/about-us/our-people/abel-pau-garcia" target="_blank" id="x_carrec_link" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">MiraMon
 Technical Lead </a></b></span></div>
</td>
</tr>
<tr>
<td style="padding-top:2px; padding-bottom:2px; color:rgb(68,91,78)">
<div style="font-family:Arial; font-size:13px"><span style="color:rgb(68,91,78)"><b><a href="mailto:a.pau@creaf.cat" id="x_correu_link" class="x_OWAAutoLink x_moz-txt-link-freetext" style="color:rgb(68,91,78)">a.pau@creaf.cat</a></b><a href="mailto:a.pau@creaf.cat" id="x_correu_link" class="x_OWAAutoLink" style="color:rgb(68,91,78)">
</a></span></div>
</td>
<td rowspan="4" align="right" style="vertical-align:top; width:105px">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<img id="x_logo_opcional" width="105" height="50" style="width:105px; height:50px" src="https://www.creaf.cat/sites/default/files/cap_0.png">
</div>
</td>
</tr>
<tr>
<td style="padding-top:2px; padding-bottom:2px; color:rgb(68,91,78)">
<div style="font-family:Arial; font-size:13px"><span style="color:rgb(68,91,78)"><b><a href="https://teams.microsoft.com/l/chat/0/0?users=a.pau@creaf.cat" id="x_teams_link" class="x_OWAAutoLink" style="color:rgb(68,91,78)">Let's chat on Teams!</a></b><a href="https://teams.microsoft.com/l/chat/0/0?users=a.pau@creaf.cat" id="x_teams_link" class="x_OWAAutoLink" style="color:rgb(68,91,78)">
</a></span></div>
</td>
</tr>
<tr>
<td style="padding-top:2px; padding-bottom:2px; color:red">
<div style="font-family:Arial; font-size:13px"><span style="color:rgb(68,91,78)"><b><a href="" id="OWA7d8566cd-3930-a662-4f8d-442844165ec9" class="x_OWAAutoLink" style="color:rgb(68,91,78); text-decoration:none">Tel. +34
</a></b></span></div>
</td>
</tr>
<tr>
<td style="padding-top:2px; padding-bottom:2px; color:rgb(68,91,78)"><br>
</td>
</tr>
<tr>
<td colspan="2" style="padding-top:2px; padding-bottom:2px; color:rgb(188,88,2)">
<div style="font-family:Arial; font-size:13px"><a href="https://twitter.com/CREAF_ecologia" target="_blank" id="OWA5aed5506-cace-f46f-f509-0f476bedd558" class="x_OWAAutoLink" style="text-decoration:none"><img width="30" height="30" style="width:30px; height:30px" src="https://www.creaf.cat/sites/default/files/2024-10/x_30.png">
</a><a href="https://www.linkedin.com/company/creaf/" target="_blank" id="OWA3c9f8bda-e7a9-1158-1a5d-3f92f7ed86ca" class="x_OWAAutoLink" style="text-decoration:none"><img width="30" height="30" style="width:30px; height:30px" src="https://www.creaf.cat/sites/default/files/2024-10/linkedin_30.png">
</a><a href="https://www.youtube.com/c/creafecologia" target="_blank" id="OWAeec9d058-cbc9-a8c7-caf8-6c29c3e0f8cc" class="x_OWAAutoLink" style="text-decoration:none"><img width="30" height="30" style="width:30px; height:30px" src="https://www.creaf.cat/sites/default/files/2024-10/youtube_30.png">
</a><a href="https://www.instagram.com/CREAF_ecologia/" target="_blank" id="OWA9f57f6fb-9dbc-9e7a-a4a2-1bcf2cbbc3e9" class="x_OWAAutoLink" style="text-decoration:none"><img width="30" height="30" style="width:30px; height:30px" src="https://www.creaf.cat/sites/default/files/2024-10/instagram_30.png">
</a><br>
<span style="color:rgb(188,88,2)"><b><a href="http://www.creaf.cat" target="_blank" id="OWA21fdf311-0a98-a3b7-08c8-0d3b8473f976" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">www.creaf.cat</a></b><a href="http://www.creaf.cat" target="_blank" id="OWA4489747b-0c7d-e6a3-1b9c-41e07b848cd9" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">
</a></span><b> | </b><span style="color:rgb(188,88,2)"><b><a href="https://www.creaf.cat/en/news-and-agenda/news" target="_blank" id="OWA1d3b2932-888a-aceb-abf0-56a50963e134" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">Latest news</a></b><a href="https://www.creaf.cat/en/news-and-agenda/news" target="_blank" id="OWA41653ae5-d03d-4399-486c-89112a38aaad" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">
</a></span></div>
</td>
</tr>
<tr>
<td style="color:rgb(27,36,31)">
<div style="font-family:Arial; font-size:13px"><span style="color:rgb(27,36,31)"><a href="https://www.openstreetmap.org/way/123379060" target="_blank" id="OWA3f1c9a7a-2d56-342e-2e7a-a3abba5664ac" class="x_OWAAutoLink" style="color:rgb(27,36,31); text-decoration:none">CREAF.
 Campus UAB. Edifici C. 08193 Bellaterra (Barcelona) </a></span><br>
<br>
<span style="color:rgb(188,88,2)"><b><a href="https://www.creaf.cat/privacy-policy" target="_blank" id="OWA543cc44f-06ce-7556-a169-1af30af12b06" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">Privacy policy</a></b><a href="https://www.creaf.cat/privacy-policy" target="_blank" id="OWAcf8799d3-879d-e972-a29a-b7a4328f4e83" class="x_OWAAutoLink" style="color:rgb(188,88,2); text-decoration:none">
</a></span></div>
</td>
<td rowspan="2" align="right" style="vertical-align:bottom; width:70px">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<img width="70" height="50" style="width:70px; height:50px" src="https://www.creaf.cat/sites/default/files/2024-10/corner_right_0.png">
</div>
</td>
</tr>
<tr>
<td style="color:rgb(153,153,153)">
<div style="font-family:Arial; font-size:11px"><span style="color:rgb(153,153,153)"><a href="" target="_blank" id="OWAc220387e-6d7a-ad84-6861-1e0a0fb75a37" class="x_OWAAutoLink" style="color:rgb(153,153,153); text-decoration:none">Before printing this electronic
 message, think about the environment. </a></span></div>
</td>
</tr>
</tbody>
</table>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</div>
<br>
<fieldset class="x_moz-mime-attachment-header"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="x_moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="x_moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="x_moz-signature" cols="72">-- 
<a class="x_moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
</body>
</html>