TransWikia.com

Calling gdal_pansharpen.py from another Python script?

Geographic Information Systems Asked by Nathan Raley on February 8, 2021

Has anyone been able to successfully call gdal_pansharpen.py from your own Python script?

I have successfully used rasterio to combine my R, G, and B bands, but would like to perform a pansharpen on the final image using the gdal_pansharpen command.

How did you manage to make the call?

One Answer

Ensure gdal_pansharpen.py is in your python path. You may need to add it by setting the PYTHONPATH env var before running your script, or within your script, i.e. sys.path.append('gdal_pansharpen/directory').

from gdal_pansharpen import gdal_pansharpen 
gdal_pansharpen(['-b', '1', '-b', '2', '-b', '3', 'input_pan.tif', 'input_multi.tif', 'output_pansharpened.tif'])

Answered by user2856 on February 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP