How do I use MULTIBAND read to read a BIL file of elevation data in Mapping Toolbox 3.6 (R2012b) ?

25 views (last 30 days)
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

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Jul 2013
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

More Answers (0)

Products


Release

R2012b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!