[Gdal-dev] Create Images with GDAL in C#
Jean Michel PIERRET
jmp at geosys.com
Mon Nov 13 14:15:06 EST 2006
Hi,
I've just tried to use the GDAL C#, it's ok to read images,
But i have problem to create images, all my created images are empty.
public static void create(string file)
{
Driver dv;
Dataset ds;
Band ba;
int bXSize, bYSize;
int w, h;
string [] options;
w = 100;
h = 100;
bXSize = w;
bYSize = 1;
dv = gdal.GetDriverByName("GTiff");
options = new string [] {"BLOCKXSIZE=" + bXSize, "BLOCKYSIZE=" +
bYSize};
ds = dv.Create(file, w, h, 1, gdalconst.GDT_Float32, options);
ba = ds.GetRasterBand(1);
float [] buffer;
buffer = new float [w * h];
for (int i = 0; i < buffer.Length; i++)
buffer[i] = i;
b.WriteRaster(0, 0, w, h, buffer, w, h, 0, 0);
b.FlushCache();
d.FlushCache();
b.Dispose();
d.Dispose();
}
Thanks for your help and all your work on c# bindings.
PIERRET Jean michel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20061113/4589b000/attachment.html
More information about the Gdal-dev
mailing list