Loading a CADRG map

Does anyone have an example of how to open a CADRG format raster map as an Image? If I try to open the A.TOC file, the open fails.

Thanks…

Welcome to this forum.

I’m not familiar with this format but I can see GDAL can open it: Raster Product Format/RPF.
So, in theory, MapWinGIS should be able to open the file as well. The difficulty is in the subdataset.

Here’s an example with an HDF5 file:

   const string filename = @"HDF5\test.h5";
    // Check if GDAL can open it:
    var utils = new Utils();
    var settings = new GlobalSettings();
    var info = utils.GDALInfo(filename, string.Empty);
    Assert.IsNotNull(info, "Could not read gdalinfo: " + settings.GdalLastErrorMsg);
    Debug.WriteLine(info);
    Assert.IsTrue(info.Contains("Driver: HDF5/Hierarchical Data Format Release 5"), "File is not recognized");

    var ds = new GdalDataset();
    if (ds.Open(filename, true))
    {
        Debug.Print("Sub datasets");
        for (int i = 0; i < ds.SubDatasetCount; i++)
        {
            string name = ds.GetSubDatasetName(i);
            Debug.Print(name);
        }
    }

    // Open HDF file using subset:
    var subset = $"HDF5:\"{filename}\"://image1/image_data";
    var infoSubset = utils.GDALInfo(subset, string.Empty);
    Assert.IsNotNull(infoSubset, "Could not read gdalinfo: " + settings.GdalLastErrorMsg);
    Debug.WriteLine(infoSubset);
    Assert.IsTrue(infoSubset.Contains("Driver: HDF5Image/HDF5 Dataset"), "File is not recognized");

    // Open subdataset as grid:
    var grd = new Grid();
    var result = grd.Open(subset);
    Assert.IsTrue(result, "Could not open HDF5 subset as grid");

    Debug.WriteLine(grd.NumBands);
    Debug.WriteLine(grd.Extents.ToDebugString());
    Debug.WriteLine(grd.Minimum.ToString());
    Debug.WriteLine(grd.Maximum.ToString());

image1/image_data is the name of the subdataset.