<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I figured a way around this, and to be completely honest this issue was coming up from using the DIMAP files (for Pleiades NEO and HR) for the panchromatic and multispectral images and so were loaded with the DIMAP driver. <br>
<br>
1. My images for input to pansharpening had no geotransform, as they were generated through several math processing steps using the DIMAP files (for Pleiades NEO and HR) for the panchromatic and multispectral images and so were loaded with the DIMAP driver.
The Geotransform was of the form (0.0, 1.0, 0.0, 0.0, 0.0, 1.0), and this makes gdal_pansharpen unhappy.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
2. I set the geotransform to that of one of the tif files (formatted with RxCx, using the first one) that contains a geotransform that makes sense for the origin of the image and RPCs, i.e., R1C1 i.e., the upper leftmost image in the delivery. This geotransform
matches well enough to make pansharpening happy across the full dataset extent.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
3. On the pansharpened result, remove the geotransform with <code>gdal_edit.py -unsetgt <file></code> and copy in the RPCs from the original DIMAP file.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This produces a file that can be used downstream for orthorectification or any other operations utilizing the RPCs.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for the input!</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Joe<br>
<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>From:</b> Joe McGlinchy <joe@aidash.com><br>
<b>Sent:</b> Tuesday, February 25, 2025 14:53<br>
<b>To:</b> Rahkonen Jukka <jukka.rahkonen@maanmittauslaitos.fi>; Howard Butler <howard@hobu.co>; gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi Jukka,</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
That is almost exactly along the lines of what I was thinking: fake the geotransform and CRS data to get past the non-existent CRS data within this level of imagery, and then copy back in the appropriate metadata. Thanks for your response! I'll give it a try.</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Cheers,</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Joe</div>
<div id="x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Rahkonen Jukka <jukka.rahkonen@maanmittauslaitos.fi><br>
<b>Sent:</b> Tuesday, February 25, 2025 14:51<br>
<b>To:</b> Joe McGlinchy <joe@aidash.com>; Howard Butler <howard@hobu.co>; gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org><br>
<b>Subject:</b> Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:Helvetica}
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
@font-face
{font-family:Aptos}
p.x_x_MsoNormal, li.x_x_MsoNormal, div.x_x_MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif}
a:link, span.x_x_MsoHyperlink
{color:#467886;
text-decoration:underline}
span.x_x_Shkpostityyli21
{font-family:"Aptos",sans-serif;
color:windowtext}
.x_x_MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:70.85pt 2.0cm 70.85pt 2.0cm}
-->
</style>
<div lang="FI" style="word-wrap:break-word">
<p style="text-align:justify"><span style="color:#ff0000">EXTERNAL SENDER. DO NOT click links, or open attachments, if the sender is unknown, or the message seems suspicious in any way. DO NOT provide your user ID or Password.</span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"> </p>
<div>
<div class="x_x_WordSection1">
<p class="x_x_MsoNormal"><span style="font-size:11.0pt">Hi,</span></p>
<p class="x_x_MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="x_x_MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I have never done anything with RPCs, but maybe you could remove RPCs with something like “gdal_translate -co profile=baseline input.tif output.tif” (delete the aux.xml or use that magic config
option that I do not remember out of my head), define some fake geotransformation by defining same ullr coordinates and crs for both PAN and MS images, then pansharpen, and finally copy the RPCs back like you have done before. I apologize if this does not
make any sense.</span></p>
<p class="x_x_MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span></p>
<p class="x_x_MsoNormal"><span lang="EN-US" style="font-size:11.0pt">-Jukka Rahkonen-</span></p>
<p class="x_x_MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_x_MsoNormal"><b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif">Lähettäjä:</span></b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>Puolesta </b>Joe McGlinchy via gdal-dev<br>
<b>Lähetetty:</b> tiistai 25. helmikuuta 2025 23.38<br>
<b>Vastaanottaja:</b> Howard Butler <howard@hobu.co>; gdal-dev@lists.osgeo.org<br>
<b>Aihe:</b> Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6</span></p>
</div>
</div>
<p class="x_x_MsoNormal"> </p>
<div>
<p class="x_x_MsoNormal"><span style="color:black">My apologies for the repost, was not aware that is against the rules of the list-serv. noted!</span></p>
</div>
<div>
<p class="x_x_MsoNormal"><span style="color:black"> </span></p>
</div>
<div>
<p class="x_x_MsoNormal"><span style="color:black">The workflow I described, pansharpening on data in image space, is a common practice. This being deprecated was surprising to see as a user, but I understand the reasoning in the migration notes. If I end up
determining a workflow that allows similar functionality with gdal > 3.6, I'll be sure to respond accordingly for the benefit of the community. </span></p>
</div>
<div>
<p class="x_x_MsoNormal"><span style="color:black"> </span></p>
</div>
<div>
<p class="x_x_MsoNormal"><span style="color:black">As for the rest of the reply, from one working professional to another, I'll look past it. thanks!</span></p>
</div>
<div>
<p class="x_x_MsoNormal"><span style="color:black"> </span></p>
</div>
<div>
<p class="x_x_MsoNormal"><span style="color:black">-Joe</span></p>
</div>
<div class="x_x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p class="x_x_MsoNormal"><b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:black">From:</span></b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:black"> Howard Butler <<a href="mailto:howard@hobu.co">howard@hobu.co</a>><br>
<b>Sent:</b> Tuesday, February 25, 2025 14:25<br>
<b>To:</b> Joe McGlinchy <<a href="mailto:joe@aidash.com">joe@aidash.com</a>><br>
<b>Cc:</b> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a> <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>><br>
<b>Subject:</b> Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6</span>
</p>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
</div>
<div>
<p style="text-align:justify"><span style="color:red">EXTERNAL SENDER. DO NOT click links, or open attachments, if the sender is unknown, or the message seems suspicious in any way. DO NOT provide your user ID or Password.</span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"> </p>
<div>
<div>
<p class="x_x_MsoNormal">Joe,</p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<p class="x_x_MsoNormal">Ask the AI from AiDASH to tell you how to do it? Oh, right, the GDAL list is your training corpus, not the inference data.
</p>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<div>
<p class="x_x_MsoNormal">Sorry for being snotty, but please refrain from reposting questions to the list like this. If no one answered your question the first time, the LLM hallucinates and pukes out-of-order GDAL arguments at you, and you cannot dig through
the source code and documentation to figure it out yourself, you should hire a consultant. <a href="https://gdal.org/en/stable/community/service_providers.html">https://gdal.org/en/stable/community/service_providers.html</a> is a list of a few, and inspecting
the commit history of the repository should give you some inspiration for others to privately contact.</p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<div>
<p class="x_x_MsoNormal">Howard</p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
<div>
<p class="x_x_MsoNormal"><br>
<br>
</p>
<blockquote style="margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<p class="x_x_MsoNormal">On Feb 25, 2025, at 2:51<span style="font-family:"Arial",sans-serif"> </span>PM, Joe McGlinchy via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> wrote:</p>
</div>
<p class="x_x_MsoNormal"> </p>
<div>
<div>
<p class="x_x_MsoNormal">Any advice on how to pansharpen image space data with RPCs in gdal >= 3.7?? Repeating below. </p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<p class="x_x_MsoNormal" style="background:white"><span style="color:black">Hello,</span></p>
<p class="x_x_MsoNormal" style="background:white"> </p>
<p class="x_x_MsoNormal" style="background:white"><span style="color:black">I saw in the migration notes from GDAL 3.6 -> 3.7:<br>
<br>
- Pansharpening now requires that panchromatic and multispectral bands have valid geotransform (in early versions, it was assumed in the case of missing geotransform that they covered the same geospatial extent). The undocumented VRT pansharpened MSShiftX
and MSShiftY options (and the corresponding C++ GDALPansharpenOptions::dfMSShiftX and dfMSShiftY members) have been removed, due to using the inverted convention as one would expect, and being sub-par solution compared to using geotransform to correlate
pixels of panchromatic and multispectral bands.</span></p>
<p class="x_x_MsoNormal" style="background:white"> </p>
<p class="x_x_MsoNormal" style="background:white"><span style="color:black">Previously, I had been taking a PAN and MS set of images with RPCs and running gdal_pansharpen, then copying over the RPCs from the PAN file, then continuing on in my workflow. This
no long works past GDAL 3.6, so is there a recommended workflow for doing this? I've been able to "gdalwarp -rpc" the files prior to calling gdal_pansharpen, but i'd like to retain the image in image space with RPCs if possible.</span></p>
<p class="x_x_MsoNormal" style="background:white"> </p>
<p class="x_x_MsoNormal" style="background:white"><span style="color:black">thanks,</span></p>
<p class="x_x_MsoNormal" style="background:white"><span style="color:black">Joe</span></p>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<div class="x_x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="702" align="center" style="width:526.25pt">
</div>
<div id="x_x_x_divRplyFwdMsg">
<p class="x_x_MsoNormal"><b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif">From:</span></b><span class="x_x_xapple-converted-space"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif"> </span></span><span style="font-size:11.0pt; font-family:"Calibri",sans-serif">Joe
McGlinchy <<a href="mailto:joe@aidash.com">joe@aidash.com</a>><br>
<b>Sent:</b><span class="x_x_xapple-converted-space"> </span>Friday, February 14, 2025 10:37<br>
<b>To:</b><span class="x_x_xapple-converted-space"> </span><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a> <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>><br>
<b>Subject:</b><span class="x_x_xapple-converted-space"> </span>pansharpening on images with RPCs post GDAL 3.6</span><span style="font-size:13.5pt; font-family:"Helvetica",sans-serif">
</span></p>
<div>
<p class="x_x_MsoNormal"><span style="font-size:13.5pt; font-family:"Helvetica",sans-serif"> </span></p>
</div>
</div>
<div>
<div>
<p class="x_x_MsoNormal">Hello,</p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<div>
<p class="x_x_MsoNormal">I saw in the migration notes from GDAL 3.6 -> 3.7:<br>
<br>
- Pansharpening now requires that panchromatic and multispectral bands have valid geotransform (in early versions, it was assumed in the case of missing geotransform that they covered the same geospatial extent). The undocumented VRT pansharpened MSShiftX
and MSShiftY options (and the corresponding C++ GDALPansharpenOptions::dfMSShiftX and dfMSShiftY members) have been removed, due to using the inverted convention as one would expect, and being sub-par solution compared to using geotransform to correlate
pixels of panchromatic and multispectral bands.</p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<div>
<p class="x_x_MsoNormal">Previously, I had been taking a PAN and MS set of images with RPCs and running gdal_pansharpen, then copying over the RPCs from the PAN file, then continuing on in my workflow. This no long works past GDAL 3.6, so is there a recommended
workflow for doing this? I've been able to "gdalwarp -rpc" the files prior to calling gdal_pansharpen, but i'd like to retain the image in image space with RPCs if possible.</p>
</div>
<div>
<p class="x_x_MsoNormal"> </p>
</div>
<div>
<p class="x_x_MsoNormal">thanks,</p>
</div>
<div>
<p class="x_x_MsoNormal">Joe</p>
</div>
</div>
<p class="x_x_MsoNormal"><span style="font-size:13.5pt; font-family:"Helvetica",sans-serif">_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></span></p>
</div>
</blockquote>
</div>
<p class="x_x_MsoNormal"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>