[Gdal-dev] Getting Single Band (grayscale) GeoTiff to pass through C# wrapper into bitmap (or othe manipulation of raster data)

Tamas Szekeres szekerest at gmail.com
Tue Nov 3 17:19:27 EST 2009

2009/11/3 dbitner <donald.e.bitner at us.army.mil>:
> 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#?

You might want to convert your data into a coloured RGB raster for
displaying purposes. As an option you could wrap your data within a
GDAL VRT (virtual) data source (by defining the bands as
ComplexSource-s) and apply a LUT for each band for scaling the data.
For more information see: http://www.gdal.org/gdal_vrttut.html

Alternatively you could also do the same suff with C# in a pixel-to-pixel basis.

I'm not totally sure what you mean by utilizing your raster image in
OGR, could you clarify this?

Best regards,


More information about the gdal-dev mailing list