Skip to content

Unable to create correct alpha band in GeoPackage using 'gdal raster mosaic' #12524

@matsamentet

Description

@matsamentet

What is the bug?

I have a GeoTIFF RGB raster which uses the color 255,255,252 around the edges (without defining it as nodata in the file). I want to translate this to a GeoPackage with this color transparent using an alpha band. I have been using gdalwarp with the combination of -srcnodata "255 255 252" -dstalpha to successfully accomplish this.

With the new CLI, as far as I can see, the equivalent is gdal raster mosaic. I am not able to accomplish the same result however. Instead of creating an alpha band where the specified color is transparent, the color is defined as "Nodata" in the gpkg_metadata table (which does not make sense as RGB GeoPackages does not support the concept on Nodata according to the format documentation )

Steps to reproduce the issue

Old gdalwarp command with correct result:
gdalwarp -f gpkg -dstalpha -srcnodata "255 255 252" rgb_raster.tif gdalwarp_output.gpkg

New CLI with incorrect output:
gdal raster mosaic --of gpkg --add-alpha --src-nodata "255,255,252" --dst-nodata 0,0,0 rgb_raster.tif gdalmosaic_output.gpkg

Versions and provenance

Windows 11
GDAL 3.11.0 from conda-forge

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions