[gdal-dev] pansharpening on images with RPCs post GDAL 3.6

Joe McGlinchy joe at aidash.com
Tue Feb 25 13:53:20 PST 2025


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.rahkonen at maanmittauslaitos.fi>
Sent: Tuesday, February 25, 2025 14:51
To: Joe McGlinchy <joe at aidash.com>; Howard Butler <howard at hobu.co>; gdal-dev at lists.osgeo.org <gdal-dev at 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-bounces at lists.osgeo.org> Puolesta Joe McGlinchy via gdal-dev
Lähetetty: tiistai 25. helmikuuta 2025 23.38
Vastaanottaja: Howard Butler <howard at hobu.co>; gdal-dev at 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 <howard at hobu.co<mailto:howard at hobu.co>>
Sent: Tuesday, February 25, 2025 14:25
To: Joe McGlinchy <joe at aidash.com<mailto:joe at aidash.com>>
Cc: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org> <gdal-dev at lists.osgeo.org<mailto:gdal-dev at 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 at lists.osgeo.org<mailto:gdal-dev at 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 <joe at aidash.com<mailto:joe at aidash.com>>
Sent: Friday, February 14, 2025 10:37
To: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org> <gdal-dev at lists.osgeo.org<mailto:gdal-dev at 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 at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250225/be60f48a/attachment-0001.htm>


More information about the gdal-dev mailing list