I tried to open a .raw image (Raw image format) using GDALOpen() with GDAL C API. So, I wrote the following code to test it :

in_data = GDALOpen("/home/YOYo/workspace/NY/Data/fig.raw",GA_ReadOnly);

and the compilation is good but when I try to execute I get the following error

ERROR 4: "/home/YOYo/workspace/NY/Data/fig.raw" not recognized as a supported file format

How can I fix this error?

  • 2
    file extensions do not necessarily say anything about the content. What is it and where does it come from? Raw can mean anything. – pLumo Jul 27 '17 at 12:33
  • +1 @RoVo. GDAL supports several formats that claim to be 'raw' and, by their individual definitions of 'raw' they are... but they are not mutually compatible. On top of that most raw datasets also have issues of endedness (big endinan or little endian) which can vary for the same file type between (say) Linux and Windows (these OSs default to different endians). Give all this, I personally try to steer clear of 'raw' images. – MappaGnosis Jul 31 '17 at 16:10

If your "*.raw" images are digital camera raw image files, then you'll need to convert them to a format that GDAL can read using a RAW Editor like Adobe Lightroom (commercial), Darktable (opensource), or RawTherapee (opensource).

If your images are actually just raw binary data, then GDAL can read it, you just need to tell GDAL the layout of the binary file (the number of columns and rows, data type, any offset) by setting up a header file. See this answer for details on using a VRT file as a header. You could also generate an ENVI .hdr, an ESRI .hdr, an ERMapper .ers, or a Generic Binary .hdr header file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.