<div dir="ltr"><div>Sorry. Maybe I didn't explain myself very well.</div><div><br></div><div>I am trying to open raster files just for reading. I don't want to modify them, or add any file to the directory. (It is not blocked by the operating system; we just don't want to modify user's data folder).</div><div>It was the case, until we are reading thermal files like the one in the tests: data/jpeg/dji/DJI_M3T.JPG</div><div>In that case the side car file appears.</div><div>Probably due to some code in the Thermal management like</div><div> SetMetadataItem("RawThermalImageWidth",...</div><div>that is calling "PamInitialize()"</div><div><br></div><div>Notice that we don't know in advance the type of file. They are just JPG files in a folder that we have to read.</div><div><br></div><div>We want to avoid to create side car files, but we want to read them if the user created them (not us).</div><div><br></div><div>Looking at gcore/gdalpamdataset.cpp, I can see in "GDALPamDataset::PamInitialize"</div><div> if (!CPLTestBool(CPLGetConfigOption("GDAL_PAM_ENABLED", pszPamDefault)))<br> {<br> CPLDebugOnce("GDAL", "PAM is disabled");<br> nPamFlags |= GPF_DISABLED;<br> }</div><div>and later in "GDALPamDataset::TryLoadXML" it checks it:</div><div> if (psPam == nullptr || (nPamFlags & GPF_DISABLED) != 0)<br> return CE_None;</div><div><br></div><div>So I guess that GDAL_PAM_ENABLED is not only blocking the creation of the side car file, but also reading it.</div><div><br></div><div>Is there a way to get this with the current state of GDAL?</div><div><br></div><div>Cheers</div><div>Javier.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, 3 Nov 2025 at 15:26, Daniel Evans <<a href="mailto:daniel.fred.evans@gmail.com">daniel.fred.evans@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Hi David,<div dir="auto"><br></div><div dir="auto">I'm familiar with the sort of behaviour Javier mentions from using QGIS. Opening some file formats in read-only mode in QGIS (at least, I assume that's what QGIS defaults to if I just view a raster!) will cause "nuisance" .aux.xml sidecar files to be written with band statistics.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Daniel</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 3 Nov 2025, 14:20 David Klaus via gdal-dev, <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="ltr">Javier,<div><br></div><div>That is strange. I could be wrong and maybe someone can weigh in if I am. But, I believe that aux files are created when you try to write information about or into the file that can't be stored within the file (for one reason or another). Are you trying to generate information about the file? Perhaps a code snippet would help everyone identify the issue?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 3, 2025 at 9:12 AM Javier Jimenez Shaw <<a href="mailto:j1@jimenezshaw.com" rel="noreferrer" target="_blank">j1@jimenezshaw.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thank you David.</div><div><br></div><div>Unfortunately I don't want to (a.k.a. cannot) change the original files. I don't want to write any type of file in that directory (like the .aux.xml files).</div><div><br></div><div>(note: I am opening the files in C++ with GDALOpenEx)</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 3 Nov 2025 at 14:45, David Klaus <<a href="mailto:dklaus@carlsonsw.com" rel="noreferrer" target="_blank">dklaus@carlsonsw.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr">Hi Javier,<br><br>I'm not sure if this applies to your use case, but I ran into a similar issue embedding geolocation information in PDF files. Sidecar files were created, but the geolocation data wasn’t embedded directly in the PDF.<br><br>At my company, we use the C++ GDAL API, and I was able to resolve it by opening the GDALDataset with the GDALAccess::GA_Update flag.<br><br>As for whether GDAL reads sidecar files when present—I believe it does, but I'm not entirely certain, so I’ll defer to others on that point.<br><br>Hope this helps,<br><br><div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 3, 2025 at 4:13 AM Javier Jimenez Shaw via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org" rel="noreferrer" target="_blank">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi</div><div><br></div><div>When I read some raster files (in particular thermal JPEG files), a side car file .aux.xml appears next to it.</div><div><br></div><div>I would like to avoid the creation of this side car file, but I want to use any .aux.xml file if it is already there. Yes, I could imagine there is a performance impact if I read it several times, but I am going to read the file only once.</div><div><br></div><div>The config option GDAL_PAM_ENABLED seems to be completely disabling PAM functionality:</div><div><a href="https://gdal.org/en/stable/user/configoptions.html#persistent-auxiliary-metadata-pam-options" rel="noreferrer" target="_blank">https://gdal.org/en/stable/user/configoptions.html#persistent-auxiliary-metadata-pam-options</a></div><div>Reading the documentation, I would imagine that the PAM is completely disabled, not only the creation of the side car file while reading a raster.</div><div><br></div><div>Is it posible to not create the .aux.xml, but use it if present?</div><div><br></div><div>Thank you</div></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" rel="noreferrer" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">David Klaus<div>Carlson Software</div></div></div>
<br><br><p style="font-family:Verdana;font-size:10pt;color:rgb(119,119,119)"><b>Disclaimer</b></p><p style="font-family:Verdana;font-size:8pt;color:rgb(119,119,119)">The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.</p></div>
</div></blockquote></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">David Klaus<div>Carlson Software</div></div></div>
<br><br><p style="font-family:Verdana;font-size:10pt;color:rgb(119,119,119)"><b>Disclaimer</b></p><p style="font-family:Verdana;font-size:8pt;color:rgb(119,119,119)">The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.</p></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" rel="noreferrer" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div></div></div>
</blockquote></div>