[Gdal-dev] Getting Single Band (grayscale) GeoTiff to pass
through C# wrapper into bitmap (or othe manipulation of raster data)
donald.e.bitner at us.army.mil
Tue Nov 3 16:51:14 EST 2009
That was insanely easy, I feel like a total idiot...I seriously contemplated
going the 1 for 1 route, but decided that I wasn't getting the correct data
into my buffer. I guess I wasn't fiddling with the correct datatype (which
I thought I did try to force it to float).
To get the bitmap image I did have to scale the floats to be RGB compliant
(0 to 255). Is this a correct way to display an elevation geotiff?? Also,
are there any plans in utilizing a raster image (IE this geotiff I have) as
a DEM in OGR, specifically for C#?
This library is a lifesaver fyi...Thanks!
Tamas Szekeres wrote:
> Since you have a single band image the GDALRead.cs would be a better
> example how to do this
> However all the examples out there use byte data type, and you might
> have to modify the examples to pass an array of floats instead of
> bytes, something like:
> Band band = ds.GetRasterBand(1);
> float data = new float[width * height];
> band.ReadRaster(0, 0, width, height, data, width, height, 0, 0);
> Best regards,
View this message in context: http://n2.nabble.com/Getting-Single-Band-grayscale-GeoTiff-to-pass-through-C-wrapper-into-bitmap-or-othe-manipulation-of--tp3940618p3941529.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev