How do I use MULTIBAND read to read a BIL file

Illustration
read_envihdr - 2022-02-01T11:01:34+00:00
Question: How do I use MULTIBAND read to read a BIL file

How do I use MULTIBAND read to read a BIL file of elevation data in Mapping Toolbox 3.6 (R2012b) ? I have downloaded data from USGS and have the a .BIL file and the following header file (.HDR). From this information, how do I determine the arguments to be passed to MULTIBANDREAD, to read and display the image ?     BYTEORDER I LAYOUT BIL NROWS 1383 NCOLS 1621 NBANDS 1 NBITS 16 BANDROWBYTES 3242 TOTALROWBYTES 3242 PIXELTYPE SIGNEDINT ULXMAP -121.386990740857 ULYMAP 43.7869907403301 XDIM 9.25925925999961e-005 YDIM 9.25925925999957e-005 NODATA 32767  

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

The raster file in .BIL format can be read using the MULTIBAND function in the Mapping Toolbox. The arguments to the function are all obtained from the corresponding fields of the header file.

filename ='MyFiles\Bil\45765067\45765067.bil';

% From the .hdr file, I obtained the following arguments for the MUTLIBANDREAD function.

size =      [ 1383 1621 1];      % [ NROWS NCOLS NBANDS]

precision = 'int16';                  % from NBITS and PIXEL TYPE = int

offset = 0;                              % since the header is not included in this file

interleave = 'bil';                     % LAYOUT

byteorder = 'ieee-le';              % BYTEORDER = I (refers to Intel order or little endian format)

X_bil = multibandread(filename, size, precision, offset, interleave, byteorder);

figure, imagesc(X_bil)               % Display the image file using IMAGESC

demcmap(X_bil)                        % Changing the colormap

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!