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

Ivan Lucena ivan.lucena at princeton-ma.us
Fri Dec 14 16:21:55 PST 2012


gdal_translate -of VRT input.tif output.vrt -b 1 -b 2 -b 3

Mike, you can try to adapt that call to a for loop if it does what you expect.

>  -------Original Message-------
>  From: Smith, Michael <Michael.Smith at maine.gov>
>  To: gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
>  Subject: Re: [gdal-dev] how to gdalwarp 4-band orthoimagery
>  Sent: Dec 14 '12 15:33
>  
>  Thanks Evan
>  
>  BUT
>  
>  Firstly in my binaries-only install I don't see any .cpp files
>  
>  And secondly the other method (using VRTs) how would one then automate that (to do, 
say 1000 tiles in a script).  The editing of the VRT would be the tricky part.
>  
>  ======================================
>  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
>  
>  | MEGIS | GeoLibrary | MEGUG | NSGIC |
>  
>  ***NOTE NEW ADDRESS***
>  
>  State House Station 145
>  51 Commerce Drive
>  Augusta, ME 04333-0145
>  
>  69d 47' 58.9"W   44d 21' 54.8"N
>  -----Original Message-----
>  From: Even Rouault [mailto:even.rouault at mines-paris.org]
>  Sent: Friday, December 14, 2012 1:48 PM
>  To: gdal-dev at lists.osgeo.org
>  Cc: Smith, Michael
>  Subject: Re: [gdal-dev] how to gdalwarp 4-band orthoimagery
>  
>  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
>  _______________________________________________
>  gdal-dev mailing list
>  gdal-dev at lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list