<html><div style='background-color:'><DIV class=RTE>Hello,</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> 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> </DIV>
<DIV class=RTE> 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, 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 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> </DIV>
<DIV class=RTE> </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->hSrcDS = hSrcDS;<BR>psWarpOptions->hDstDS = hDstDS;<BR>psWarpOptions->nBandCount = 3;<BR>psWarpOptions->panSrcBands = (int *) CPLMalloc(sizeof(int) * psWarpOptions->nBandCount);<BR>psWarpOptions->panSrcBands[0] = 1;<BR>psWarpOptions->panSrcBands[1] = 1;<BR>psWarpOptions->panSrcBands[2] = 1;<BR>psWarpOptions->panDstBands = (int *) CPLMalloc(sizeof(int) * psWarpOptions->nBandCount);<BR>psWarpOptions->panDstBands[0] = 1;<BR>psWarpOptions->panDstBands[1] = 1;<BR>psWarpOptions->panDstBands[2] = 1;</DIV></BLOCKQUOTE>
<DIV class=RTE> 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> </DIV>
<DIV class=RTE> Thank you ahead and I apologize for probably trivial question.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> Ilya S.</DIV>
<DIV class=RTE> </DIV></div></html>