<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>> The underlying Warp API does contain mechanisms whereby an
application<BR>> might be able to maintain an alpha band properly, but the
gdalwarp<BR>> program has no mechanism to take advantage of it.
Furthermore, this<BR>> hasn't really be used in the warp api so there may be
issues I didn't<BR>> anticipate.<BR>> <BR>> Currently, the gdalwarp
assumption is that nodata pixel values will be<BR>> used to mark unset
areas. So that might involve picking a "background"<BR>> value, like 0,
to mark all unset areas. INIT_DEST could be used to<BR>> pre-apply this
to the output file if a non-zero value were used. Then<BR>> the warper
would replace all pixels for which a value exists. No
mechanism<BR>> exists to ensure that the nodata value doesn't existing in the
valid image<BR>> data though.<BR>> <BR>> I think it would make sense to
modify gdalwarp to explicitly support<BR>> transparency layers. Some
common forms I could imagine are:<BR>> <BR>> o An extra output
band used to hold transparency. Normally this
would<BR>> be assigned 0 to unset pixels and 255 for
set pixels.</DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This feature would be extremely useful for my
situation as well. I do not necessarily need the first more difficult
option (the ability to create an additional transparent band) as I would
only need the ability to filter out the aformentioned "nodata" value in the
image. Both methods would work for my situation though. I could
write the necessary code if need be. I was thinking the most consistant to
your way of doing things was to add another option in papszWarpOptions
called REPLACE = TRUE or FALSE.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Then after the rasterdata is fetched in <FONT
size=2>WarpRegionToBuffer() </FONT>from the source file I would loop through the
source data doing the following:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT color=#0000ff size=3>
<DIV><FONT face=Arial color=#000000 size=2>for</FONT></FONT><FONT size=2><FONT
face=Arial>(i = 0</FONT><FONT face=Arial>; i < (nWordSize * nSrcXSize *
nSrcYSize); i++)</FONT></FONT><FONT size=3></DIV>
<DIV><FONT face=Arial size=2>{</FONT></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial> BOOL noData =
FALSE</FONT><FONT face=Arial>;</FONT></FONT><FONT size=3></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV></FONT><FONT size=2><FONT face=Arial> for (int j =
0</FONT><FONT face=Arial>; j<psOptions->nBandCount;
j++)</FONT></FONT><FONT size=3></DIV>
<DIV><FONT face=Arial size=2> {</FONT></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial>
if(oWK.papabySrcImage[0</FONT><FONT face=Arial>][i + j * (nSrcXSize *
nSrcYSize)] == initDest[j])</FONT></FONT><FONT size=3></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial>
noData = </FONT><FONT face=Arial>TRUE</FONT><FONT
face=Arial>;</FONT></FONT><FONT size=3></DIV>
<DIV></FONT><FONT face=Arial size=2>
else</FONT><FONT size=3> </DIV>
<DIV><FONT face=Arial size=2>
{</FONT></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial>
noData = </FONT><FONT face=Arial>FALSE</FONT><FONT
face=Arial>;</FONT></FONT><FONT size=3></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial>
break</FONT><FONT face=Arial>;</FONT></FONT><FONT
size=3></DIV>
<DIV><FONT face=Arial size=2>
}</FONT></DIV>
<DIV><FONT face=Arial size=2> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV></FONT><FONT size=2><FONT face=Arial> if</FONT><FONT
face=Arial>(noData)</FONT></FONT><FONT size=3></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial>
for (int j = 0</FONT><FONT face=Arial>; j<psOptions->nBandCount;
j++)</FONT></FONT><FONT size=3></DIV>
<DIV></FONT><FONT size=2><FONT face=Arial>
oWK.papabySrcImage[</FONT><FONT face=Arial>0</FONT><FONT
face=Arial>][i + j * (nSrcXSize * nSrcYSize)]++;</FONT></FONT><FONT
size=3></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If this method seems utterly inefficient let me
know.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,<BR>Jason R. Hughes<BR>Elantech, Inc.
<BR>6411 Ivy Lane, Suite 300<BR>Greenbelt, MD 20770<BR>Phone: 301-486-0600<BR><A
href="mailto:jason.hughes@elantech-inc.com">jason.hughes@elantech-inc.com</A></FONT></DIV></FONT></BODY></HTML>