[gdal-dev] how to set raster bands with gdalwarp

easyl easy.lin at gmail.com
Tue Mar 30 09:40:32 EDT 2010


I am making map tiles from a PNG (in RGBA color) with following commands. 

gdal_translate -of VRT -a_srs EPSG:4326 -gcp ... source.png source.vrt
gdalwarp -of VRT -s_srs EPSG:4326 -t_srs EPSG:900913 source.vrt
source_web.vrt
gdal2tiles -p mercator -z 2-11 -w google source_web.vrt 

By the gdalwarp step, the source_web.vrt is generated with undesired raster
bands as following
<VRTDataset> 
  ... 
  <VRTRasterBand dataType="Byte" band="1" subClass="VRTWarpedRasterBand"/> 
  <VRTRasterBand dataType="Byte" band="2" subClass="VRTWarpedRasterBand"/> 
  <VRTRasterBand dataType="Byte" band="3" subClass="VRTWarpedRasterBand"/> 
  <VRTRasterBand dataType="Byte" band="4" subClass="VRTWarpedRasterBand"/> 
   ... 
    <BandList> 
      <BandMapping src="1" dst="1"/> 
      <BandMapping src="2" dst="2"/> 
      <BandMapping src="3" dst="3"/> 
    </BandList> 
    <SrcAlphaBand>4</SrcAlphaBand> 
  </GDALWarpOptions> 
</VRTDataset> 

How can I use gdalwarp or other utilities to let vrt generated with RGBA
bands as following.

<VRTDataset> 
  ... 
  <VRTRasterBand dataType="Byte" band="1" subClass="VRTWarpedRasterBand"> 
    <Metadata/> 
    <ColorInterp>Red</ColorInterp> 
  </VRTRasterBand> 
  <VRTRasterBand dataType="Byte" band="2" subClass="VRTWarpedRasterBand"> 
    <Metadata/> 
    <ColorInterp>Green</ColorInterp> 
  </VRTRasterBand> 
  <VRTRasterBand dataType="Byte" band="3" subClass="VRTWarpedRasterBand"> 
    <Metadata/> 
    <ColorInterp>Blue</ColorInterp> 
  </VRTRasterBand> 
  <VRTRasterBand dataType="Byte" band="4" subClass="VRTWarpedRasterBand"> 
    <Metadata/> 
    <ColorInterp>Alpha</ColorInterp> 
  </VRTRasterBand>
  ... 
  <GDALWarpOptions> 
      ... 
    <BandList> 
      <BandMapping src="1" dst="1"/> 
      <BandMapping src="2" dst="2"/> 
      <BandMapping src="3" dst="3"/> 
      <BandMapping src="4" dst="4"/> 
    </BandList>
  </GDALWarpOptions> 
</VRTDataset> 
-- 
View this message in context: http://n2.nabble.com/how-to-set-raster-bands-with-gdalwarp-tp4824518p4824518.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list