id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 3073,[PATCH - C#] Dataset.ReadRaster()/WriteRaster() doesn't work on multi-band datasets,Even Rouault,tamas,"Tamas, The Marshal.AllocHGlobal and Marshal.Copy calls in Dataset.ReadRaster()/WriteRaster() mainly forget to multiply the pixel count by the number of bands, thus only the data for the first band is correctly read/written for pixel-interleaved buffers. Attached a patch that fixes the issue (adapted from gdal_java.i). I've also better taken into account the pixelSpace, lineSpace and bandSpace parameters to compute the number of elements to copy, as done in BandRasterIO_Validate and DatasetRasterIO_Validate in gdal_java.i. Currently, this wouldn't work with exotic values of spacings. With that patch, the following code snippet does produce a pink image : {{{ using System; using OSGeo.GDAL; class test { public static void Main(string[] args) { Gdal.AllRegister(); Driver drv = Gdal.GetDriverByName(""GTiff""); int iWidth = 100; int iHeight = 100; Dataset ds_new = drv.Create(""testrgb.tif"", iWidth, iHeight, 3, DataType.GDT_Byte, new string[] { }); byte[] buffers = new byte[(iHeight * iWidth) * 3]; int i, j; for(i=0;i