What format do you want the alphas channel in after running gdal_polygonize.py?  I ask because after processing you could open the input and read just the alpha band (band 4 I assume).  Here is a short script framework that might get you started.<div>
<br></div><div>Something like:</div><div>from osgeo import gdal</div><div><br></div><div>gdal.open(inpudataset, gdal.GA_ReadOnly)</div><div><br></div><div>#Create an output</div><div><div>driverFormat = &quot;GTiff&quot; #Any GDAL supported write format</div>
<div>driver = gdal.GetDriverByName(driverFormat)</div><div>outdataset = driver.Create(options.output, dataset.RasterXSize, dataset.RasterYSize, dataset.RasterCount)</div><div>outdataset.SetProjection(dataset.GetProjection())</div>
<div>outdataset.SetGeoTransform(dataset.GetGeoTransform())</div><div><br></div><div>inband = gdal.GetRasterBand(4) #Band counts are 1 based.  I am assuming that your band 4 is alpha.</div><div><br></div><div>#Read in the gdal array</div>
<div>input_band = inband.ReadAsArray()</div><div>outdataset.GetRasterBand(1).WriteArray(input_band, 0, 0)</div><div><br></div><div>Someone with more experience might be able to tell you a method that uses CreateCopy(), but I think that it isn&#39;t possible to selectively copy bands.</div>
<div><br></div><div>Hope that that helps, </div><div>Jay</div><br><div class="gmail_quote">On Mon, Jul 25, 2011 at 8:19 PM, jt2000 <span dir="ltr">&lt;<a href="mailto:thakkar@nexgenwireless.com">thakkar@nexgenwireless.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have a very large raster file with data in the alpha band.  I need to<br>
vectorize it and associate band 4 data with resulting polygons.<br>
<br>
Is there anyway to preserve alpha channel data or get that data associated<br>
with vectorized file after using gdal_polygonize.py?<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/preserving-alpha-channel-data-with-gdal-transform-py-tp6620877p6620877.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/preserving-alpha-channel-data-with-gdal-transform-py-tp6620877p6620877.html</a><br>

Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</font></blockquote></div><br></div>