[gdal-dev] using gdal.Warp to reproject a GTiff with an external nodata mask (.msk)

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Mon Jan 27 08:02:25 PST 2025


Hi,
Do you suppose that the result would be two files:
"Ortho2024_3857_10cm_mask.tif"
"Ortho2024_3857_10cm_mask.tif.msk"

What the result is now? One file "Ortho2024_3857_10cm_mask.tif" with an internal mast band, or what?

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Maxime Demers via gdal-dev
Lähetetty: maanantai 27. tammikuuta 2025 17.58
Vastaanottaja: gdal-dev at lists.osgeo.org
Aihe: [gdal-dev] using gdal.Warp to reproject a GTiff with an external nodata mask (.msk)

Hi everybody, I hope you are all well!
I have an issue that I would need help about if possible.
I would like to use the GDAL Python bindings to reproject a TIFF that has an external nodata mask stored in a separate .msk file. Also, this is important to me to keep the jpeg compression.
After some tests, I found out that gdal.Warp does not reproject the .msk
Is there  a way to acheive what I am trying to do?

import os

from osgeo import gdal



IN_RASTER = os.path.join(r"C:\\", "data", "Ortho", "Ortho2024_32187_10cm_mask.tif")

OUT_RASTER = os.path.join(r"C:\\", "data", "Ortho", "Ortho2024_3857_10cm_mask.tif")



src = gdal.Open(IN_RASTER)



dst = gdal.Warp(

    OUT_RASTER,

    src,

    format="GTiff",

    dstSRS="EPSG:3857",

    creationOptions=["COMPRESS=JPEG", "PHOTOMETRIC=YCBCR", "TILED=YES", "BIGTIFF=YES"],

    callback=gdal.TermProgress_nocb

)



dst = None




[cid:image001.png at 01DB70E5.9C908420]



Maxime Demers

Analyste en géomatique

Service de la planification

et de la gestion du territoire

Tél. : 819 823-8000 poste 2360




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250127/bcf81c4b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 11331 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250127/bcf81c4b/attachment-0001.png>


More information about the gdal-dev mailing list