GDAL Color Issues

Topics: SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Jan 31, 2009 at 8:44 PM
Hello,

I'm loading an NOAA nautical map (obtained free from National Oceanic and Atmospheric Administration) into sharpmap 0.9 using the following code

layer = new SharpMap.Layers.GdalRasterLayer("nauticalA", "C:\\data\\GeoData\\13260\\13260_1.KAP");
layer.TransparentColor = Color.Black;
map.Layers.Add(layer);

The map loads however is almost all black and dark (I can barely make the map out but can tell that it is the map being loaded).

When loading the map using a map viewer which is included with fwtools the map loads properly in full color.  In it's current state the map loaded in sharpmap is unusable.

Does anyone know if there is anything that can be done to correct this ? I have noticed other posts asking a similar question (dating as far back as 2007) however nobody has given any solutions or updates.

Any information would be greatly appreciated.

Feb 12, 2009 at 1:56 PM
The raster's bit depth might be something other than 8 (the default).  Try setting the layer.BitDepth to 12 or 16.
Feb 12, 2009 at 1:57 PM
It sounds like the image might be a higher bit depth like 12 bit.  Check the bit depth of the image and if it is not 8 bit you will need to set BitDepth in gdal raster layer.  I don't know if the base version of sharpmap has this, you might have to get the patch from Dan on the patches page.
Joel
Feb 12, 2009 at 1:58 PM
in other words I agree with Dan