[gdal-dev] GDAL Open File Help Needed

Raymond Castonguay raymond.castonguay at yahoo.com
Fri Oct 9 18:09:18 PDT 2020


See code below:
I downloaded GDAL 3.x for Windows from the GISInternals website.
I have Windows 10 64Bit, Visual Studio 2019 C++
The code below loads a data file after calling GDALAllRegister();There are no runtime or GDAL errors reported.But the header results are incorrect and corrupted. See attached Debug Window.I tried loading a 3D TIFF file and a ENVI file, with the same problem. Any Idea what the problem could be?
Note, from the ENVI ascii data File Header, the raster size should be 320x190 with 256 bands for this example.
//------------------- CODEvoid CMFCApplication3Dlg::OnBnClickedButton1(){ CStringA fileName = "C:\\temp\\PC_IT5_G2.bin";
 // C++  GDALDataset* data = (GDALDataset*)GDALOpen(fileName, GA_ReadOnly);
 // C  GDALDatasetH dataH    = GDALOpen(fileName, GA_ReadOnly); GDALDriverH  hDriver = GDALGetDatasetDriver(dataH);
 CStringA NameS = GDALGetDriverShortName(hDriver); CStringA NameL = GDALGetDriverLongName(hDriver);
 int nx = GDALGetRasterXSize(hDriver); int ny = GDALGetRasterYSize(hDriver); int nz = GDALGetRasterCount(hDriver);
 CStringA errMsg = CPLGetLastErrorMsg();
 int i = 0;}
//------------------------  FILE HEADER minus Meta DataENVIacquisition time = 2020-04-29T15:53:46.486+00:0samples = 320lines = 190bands = 256header offset = 0file type = ENVI Standarddata type = 12interleave = bipbyte order = 0wavelength units = Nanometerswavelength = {  948.74, 951.95, 955.16, 958.37,  961.58, 964.79, 968, 971.22,  974.44, 977.65, 980.87, 984.1, ......
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20201010/5684beda/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GDAL C Error 1d.png
Type: image/png
Size: 62509 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20201010/5684beda/attachment-0001.png>


More information about the gdal-dev mailing list