<html><div style='background-color:'><DIV class=RTE>Hello,</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am new to GDAL and would like to clarify certain basic things that I cannot figure out not could find relevant postings on the dev list:</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am trying to warp a colour geotiff image using C++ and as a basis I used the Warp tutorial, the one with no output file,&nbsp;posted at <A href="http://www.remotesensing.org/gdal/warptut.html">http://www.remotesensing.org/gdal/warptut.html</A> . The problem I am having is that when I warp the colour image from UTM NAD83 to&nbsp;UTM WGS84 (which should produce only very slight change in image) the dimensions of the image file remains the same, but the pixels inside the image are greyscale and are squished 60%, the rest 2/3 of the image is black, the size of the output image is correspondingly one third of the original image. As far as I understand the tutorial example extracts only one band from the source image and then outputs it into the destination file, and maybe that is the reason for having only 3-rd of the pixels' volume having been written into output. I tried the following modifications but I still get the same result:</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>* Get all three colour tables instead of one. I also checked for hCT being NULL and it is in all three cases, eventhough the first case is directly from the tutorial example, and the count of bands in the source image <EM>is</EM> indeed 3, so the table <EM>should</EM> exist:</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=RTE>GDALColorTableH hCT;</DIV>
<DIV class=RTE><BR>hCT = GDALGetRasterColorTable(GDALGetRasterBand(hSrcDS,1));<BR>GDALSetRasterColorTable(GDALGetRasterBand(hDstDS,1), hCT);</DIV>
<DIV class=RTE><BR>hCT = GDALGetRasterColorTable(GDALGetRasterBand(hSrcDS,2));</DIV>
<DIV class=RTE>GDALSetRasterColorTable(GDALGetRasterBand(hDstDS,2), hCT);</DIV>
<DIV class=RTE><BR>hCT = GDALGetRasterColorTable(GDALGetRasterBand(hSrcDS,3));</DIV>
<DIV class=RTE>GDALSetRasterColorTable(GDALGetRasterBand(hDstDS,3), hCT);</DIV></BLOCKQUOTE>
<DIV class=RTE dir=ltr>* Copy all three bands from source and write all three to destination:</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=RTE dir=ltr>psWarpOptions-&gt;hSrcDS = hSrcDS;<BR>psWarpOptions-&gt;hDstDS = hDstDS;<BR>psWarpOptions-&gt;nBandCount = 3;<BR>psWarpOptions-&gt;panSrcBands = (int *) CPLMalloc(sizeof(int) * psWarpOptions-&gt;nBandCount);<BR>psWarpOptions-&gt;panSrcBands[0] = 1;<BR>psWarpOptions-&gt;panSrcBands[1] = 1;<BR>psWarpOptions-&gt;panSrcBands[2] = 1;<BR>psWarpOptions-&gt;panDstBands = (int *) CPLMalloc(sizeof(int) * psWarpOptions-&gt;nBandCount);<BR>psWarpOptions-&gt;panDstBands[0] = 1;<BR>psWarpOptions-&gt;panDstBands[1] = 1;<BR>psWarpOptions-&gt;panDstBands[2] = 1;</DIV></BLOCKQUOTE>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What exactly am I doing wrong? Why has the colour dissappeared? Perhaps someone can point me to an example of warping a colour geotiff into a colour geotiff or a relevant posting?</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thank you ahead and I apologize for probably trivial question.</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ilya S.</DIV>
<DIV class=RTE>&nbsp;</DIV></div></html>