Hello,

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.

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.
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.
3. On the pansharpened result, remove the geotransform with gdal_edit.py 
-unsetgt <file> and copy in the RPCs from the original DIMAP file.

This produces a file that can be used downstream for orthorectification or any 
other operations utilizing the RPCs.

Thanks for the input!

Cheers,
Joe

________________________________
From: Joe McGlinchy <j...@aidash.com>
Sent: Tuesday, February 25, 2025 14:53
To: Rahkonen Jukka <jukka.rahko...@maanmittauslaitos.fi>; Howard Butler 
<how...@hobu.co>; gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6

Hi Jukka,

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.

Cheers,
Joe
________________________________
From: Rahkonen Jukka <jukka.rahko...@maanmittauslaitos.fi>
Sent: Tuesday, February 25, 2025 14:51
To: Joe McGlinchy <j...@aidash.com>; Howard Butler <how...@hobu.co>; 
gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6


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.





Hi,



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.



-Jukka Rahkonen-



Lähettäjä: gdal-dev <gdal-dev-boun...@lists.osgeo.org> Puolesta Joe McGlinchy 
via gdal-dev
Lähetetty: tiistai 25. helmikuuta 2025 23.38
Vastaanottaja: Howard Butler <how...@hobu.co>; gdal-dev@lists.osgeo.org
Aihe: Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6



My apologies for the repost, was not aware that is against the rules of the 
list-serv. noted!



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.



As for the rest of the reply, from one working professional to another, I'll 
look past it. thanks!



-Joe

________________________________

From: Howard Butler <how...@hobu.co<mailto:how...@hobu.co>>
Sent: Tuesday, February 25, 2025 14:25
To: Joe McGlinchy <j...@aidash.com<mailto:j...@aidash.com>>
Cc: gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org> 
<gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>>
Subject: Re: [gdal-dev] pansharpening on images with RPCs post GDAL 3.6



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.





Joe,



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.



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. https://gdal.org/en/stable/community/service_providers.html 
is a list of a few, and inspecting the commit history of the repository should 
give you some inspiration for others to privately contact.



Howard





On Feb 25, 2025, at 2:51 PM, Joe McGlinchy via gdal-dev 
<gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>> wrote:



Any advice on how to pansharpen image space data with RPCs in gdal >= 3.7?? 
Repeating below.



Hello,



I saw in the migration notes from GDAL 3.6 -> 3.7:

- 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.



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.



thanks,

Joe



________________________________

From: Joe McGlinchy <j...@aidash.com<mailto:j...@aidash.com>>
Sent: Friday, February 14, 2025 10:37
To: gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org> 
<gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>>
Subject: pansharpening on images with RPCs post GDAL 3.6



Hello,



I saw in the migration notes from GDAL 3.6 -> 3.7:

- 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.



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.



thanks,

Joe

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to