[gdal-dev] how to gdalwarp 4-band orthoimagery

Even Rouault even.rouault at mines-paris.org
Fri Dec 14 10:48:12 PST 2012


Le vendredi 14 décembre 2012 19:17:07, Smith, Michael a écrit :
> Seems like this is a straightforward issue but finding it difficult to
> solve online.
> 
> 
> 
> I have a new crop of 4-band orthoimages, as GeoTIFFs.  I want to create
> mosaics of some tiles.  There is a slight pixel overlap at the edges. 
> When I run gdalwarp it always treats the 4th band as alpha, which causes
> the overlap edges to be lighter than everything else in the mosaic,
> creating an odd grid pattern were these edges were (when viewing the CIR
> bands 4-1-2).
> 
> 
> 
> How can I disable this treatment of the 4th band as alpha?

gdal_translate src.tif tmp.vrt -of VRT

and edit tmp.vrt to remove the   <ColorInterp>Alpha</ColorInterp> on the 4th 
band

or edit apps/gdalwarp.cpp and disable the following lines :


/* -------------------------------------------------------------------- */
/*      Do we have a source alpha band?                                 */
/* -------------------------------------------------------------------- */
        if( GDALGetRasterColorInterpretation( 
                GDALGetRasterBand(hSrcDS,GDALGetRasterCount(hSrcDS)) ) 
            == GCI_AlphaBand 
            && !bEnableSrcAlpha )
        {
            bEnableSrcAlpha = TRUE;
            if( !bQuiet )
                printf( "Using band %d of source image as alpha.\n", 
                        GDALGetRasterCount(hSrcDS) );
        }


> 
> 
> 
> ===============================
> Michael Smith MS GISP
> State GIS Manager, Maine Office of GIS
> State of Maine, Office of Information Technology
> michael.smith _at_ maine.gov
> 207-215-5530
> 
> Board Member, Maine GeoLibrary
> Board Member, Maine GIS Users Group
> State Rep, National States Geographic Information Council
> [cid:image001.png at 01CDD9FD.50D40D40][icons]
> 
> ***NOTE NEW ADDRESS***
> 
> State House Station 145
> 51 Commerce Drive
> Augusta, ME 04333-0145
> 69o 47' 58.9"W  44o 21' 54.8"N


More information about the gdal-dev mailing list