[gdal-dev] Creating a new raster and adding data
Henneke, Amanda M
amanda.m.henneke at boeing.com
Mon Jul 20 12:36:27 EDT 2009
Ok, so after some more experimentation, I think I found that the reason
it was dying was due to a file being too large. When I run it on a
smaller dataset, it seems I am successful in getting past the
WriteRaster command in my code.
The bad news is that it doesn't seem to be working properly. It seems
to write the first band correctly, but bands 2-5 are written
incorrectly. The buffer I'm using checks out before and after the
WriteRaster command. So it has got to be something with the WriteRaster
command that is not working. I've played with the offsets and all,
especially the bandspace, linespace and rasterspace arguments. Anyone
have similar problems, or any ideas as to why I can't get the
WriteRaster to work?
Thanks!
Amanda M. Henneke
When One tugs at a single thing in Nature, he finds it attached to the
rest of the world. -John Muir
Please consider the environment before printing this e-mail.
-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Friday, July 17, 2009 3:33 PM
To: Henneke, Amanda M
Subject: Re: [gdal-dev] Creating a new raster and adding data
Henneke, Amanda M wrote:
> Thanks Frank for your help, I think I'm further, but still not quite
> there.
>
> The definition requires me to send the iBandMap as an array, I cannot
> insert the index of the band I wish to write, because then I'm just
> passing an integer. So with that said, I decided to combine all my
> byte arrays (buffers) of data into one array and call Write Raster as
> follows:
>
> byte[] buffers = new byte[(iHeight * iWidth) * 3];
> r_buffer.CopyTo(buffers, 0); g_buffer.CopyTo(buffers,
> r_buffer.Length); b_buffer.CopyTo(buffers, r_buffer.Length * 2);
>
> ds_new.WriteRaster(0, 0, iWidth, iHeight, buffers, iWidth, iHeight, 3,
> iBandMap, 0, 0, 0);
>
> But I'm still getting the same exception, so something else must not
> be quite right. I've tried playing around with the pixelSpace,
> lineSpace and bandSpace parameters and still no success...any other
> ideas what I'm still missing?
Amanda,
Your new approach looks reasonable. I don't know what is going wrong.
Best regards,
--
---------------------------------------+--------------------------------
---------------------------------------+------
I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list