Loading PostGis Raster to DotSpatial

Jul 12, 2014 at 5:49 PM
Hello, I'm trying to load a PostGis Raster to DotSpatial ... I'm using the following code (this is only a test), there isn't any exception or error message but the image don't appear.

I will appreciate if somebody could help me.

Kind regards.
    byte[] imagen;
                
    string query = "SELECT ST_AsGDALRaster(rast, 'GTIff') As rastgeotiff FROM batimetrias WHERE rid=1;";
    NpgsqlCommand cmdRemotoSelect = new NpgsqlCommand(query, bDLocal.link);
        NpgsqlDataReader dr = cmdRemotoSelect.ExecuteReader();

        while (dr.Read()){
            imagen = (byte[]) dr["rastgeotiff"];
            MemoryStream ms = new MemoryStream(imagen);
            ImageData myImage = new ImageData();
            myImage.Values = imagen;
            myImage.Projection = mapGeneral.Projection;
            myImage.CopyValuesToBitmap();
            MapImageLayer imagedatalayer = new MapImageLayer(myImage);
        mapGeneral.Layers.Add(imagedatalayer);
        mapGeneral.ZoomToMaxExtent();

    }