This project is read-only.

Exporting a MapRasterLayer to .bmp in disk

Apr 18, 2013 at 12:27 PM
Edited Apr 18, 2013 at 12:48 PM
I'm trying to export a MapRasterLayer (from a BGD file) to a simple .bmp image in disk. Here it is the code:
var fichero = "C:\\dtm.bgd";
var mapa = Path.ChangeExtension(fichero, "bmp");
var raster = Raster.OpenFile(fichero);
var capa = new MapRasterLayer(raster);
var simbologia = new RasterSymbolizer{
    Scheme = new ColorScheme(ColorSchemeType.Glaciers, raster)
capa.Symbolizer = simbologia;            

// Export to image in disk
capa.ExportBitmap(mapa, ImageBandType.ARGB); 
I'm not sure if I have misunderstood the API. I assumed that ExportBitmap was the way to go, but the .bmp in disk is not showing the desired colors.

But if I use this the image in disk seems correct:
var bmp = capa.BitmapGetter.GetBitmap();
bmp.Save(mapa, ImageFormat.Bmp);
Is this the logical / recommended way to go?
Is there any other method to render to disk a Layer, or a bunch of layers in the same .bmp file? and a legend?

Thank you very much.