DEM file loading with MapWinGIS

Hellow. everyone!
I’m new to GIS and MapWinGIS. So I need your help.
I want to load a DEM file in winform.
So, I get a DEM file(file’s extentions is *.img) from http://data.nsdi.go.kr>dataset…
and I can see black and white image with QGIS desktop.

Please let me know what kind of libraries or variables are used to load *.img file.
Thanks…!!

I use
IGdalDataset dataset;
IGdalDriver driver;
and, file open…

        OpenFileDialog ofd = new OpenFileDialog
        {
            DefaultExt = "img",
            Filter = "ERDAS Image Files|*.img"
        };

        if (ofd.ShowDialog() == DialogResult.OK)
       {
            dataset = new GdalDataset();
            dataset.Open(ofd.FileName, true);
            driver = dataset.Driver;

            textBox1.AppendText("File Name : " + ofd.FileName + "\r\n");

            int subsetcnt = dataset.SubDatasetCount;
            textBox1.AppendText("SubDataSet Count : " + subsetcnt.ToString() + "\r\n");

            bool israster = driver.IsRaster;
            textBox1.AppendText("Is Raster? : " + israster.ToString() + "\r\n");

            bool isvector = driver.IsVector;
            textBox1.AppendText("Is Vector? : " + isvector.ToString() + "\r\n");

            int metedatacnt = driver.MetadataCount;
            textBox1.AppendText("Metadata Count " + metedatacnt.ToString() + "\r\n");

            string name = driver.Name;
            textBox1.AppendText("GDAL Driver Name : " + name + "\r\n");

            string mdata;
            for(int i = 0; i< driver.MetadataCount ; i++)
            {
                mdata = driver.MetadataItem[i];
                textBox1.AppendText(string.Format("Driver.MetadataItem[{0}] : ", i) + mdata + "\r\n");
            }
      }

So, I can read some data of *.img file.

SubDataSet Count : 0
Is Raster? : True
Is Vector? : False
Metadata Count 11
GDAL Driver Name : HFA
Driver.MetadataItem[0] : DCAP_CREATE=YES
Driver.MetadataItem[1] : DCAP_CREATECOPY=YES
Driver.MetadataItem[2] : DCAP_OPEN=YES
Driver.MetadataItem[3] : DCAP_RASTER=YES
Driver.MetadataItem[4] : DCAP_VIRTUALIO=YES
Driver.MetadataItem[5] : DMD_CREATIONDATATYPES=Byte Int16 UInt16 Int32 UInt32 Float32 Float64 CFloat32 CFloat64
Driver.MetadataItem[6] : DMD_CREATIONOPTIONLIST=
Driver.MetadataItem[7] : DMD_EXTENSION=img
Driver.MetadataItem[8] : DMD_EXTENSIONS=img
Driver.MetadataItem[9] : DMD_HELPTOPIC=frmt_hfa.html
Driver.MetadataItem[10] : DMD_LONGNAME=Erdas Imagine Images (.img)

Still, I don’t know where are DEM datas…

I tried others…
GdalDriverManager manager = new GdalDriverManager();
textBox1.AppendText(“GDAL Driver Count : " + manager.DriverCount.ToString() + “\r\n”);
for (int i = 0; i < manager.DriverCount; i++)
{
textBox1.AppendText(string.Format(”[{0}] : ", i) + manager.Driver[i].Name + “\r\n”);
}

I found 214 drivers in 35913.img file

I tried other one.

layerHandler = axMap1.AddLayerFromFilename(filename, tkFileOpenStrategy.fosAutoDetect, true);

then raster image is loaded to axMap1.

Let me know how to get height data(matrix) from loaded layer.
So, I want to make a profile of path[point to point]

I tried other one…

demlayerHandler = axMap1.AddLayerFromFilename(filename, tkFileOpenStrategy.fosAutoDetect, true);
object obj = axMap1.get_GetObject(demlayerHandler);

Load the added layer to object.
In Debugging, obj have dynamic views…

Please let me know, how to assign the obj’s values to float?

Finally, I get Digital Elevation datas from ***.img file.

  1. Make a axMap1 at form

  2. Load a file(in my case, get *.img files from 수치표고모델(DEM)_90M - 오픈마켓)

             demlayerHandler = axMap1.AddLayerFromFilename(filename, tkFileOpenStrategy.fosAutoDetect, true);
    
  3. Get Image from layer

             IImage img = axMap1.get_Image(demlayerHandler);
    
  4. Get rasterband

             GdalRasterBand aBand = img.ActiveBand;
    
  5. Read digital elevation values

             int xsize = aBand.XSize;
             int ysize = aBand.YSize;
             double[,] harray = new double[xsize, ysize];
    
             for (int i = 0; i<xsize; i++)
             {
                 for(int j=0; j<ysize; j++)
                 {
                     if (aBand.Value[i, j, out double pVal])
                     {
                         harray[i,j] = pVal;
                     }
                 }
             }
    
  6. Use the data to others…

Finally, I make a Geo-profile…

If someone knows other beautiful way, let me know.
Thanks…