Membuka file BIL, BIP atau BSQ di QGIS

Ketika bertemu dengan dataset penginderaan jarak jauh dan sains, seringkali data berupa format seperti BIL, BIP atau BSQ . The GDAL library - yang digunakan oleh QGIS untuk membaca file-file raster - mendukung untuk mengolah data seperti ini, tapi file-file ini tidak dapat dibuka dengan sendirinya. Kita akan melewati proses membuat file support sehingga file-file ini dapat dibaca di QGIS.

Band Interleaved by line (BIL), band interleaved by Pixel (BIP), dan Band Sequential (BSQ) adalah metode yang umum dalm mengorganisasikan dataa gambar untuk citra multiband. (Read more about these formats)

Secara tipikal, file-file ini dilengkapi oleh sebuah file .hdr . Jika dataset dilengkapi dengan sebuah file .hdr , pastikan akar nama dari file .bil, .bsq, .bip dan .hdf cocok dan berada di direktori yang sama. Contohnya, jika sebuah file bernama image.bil , file .hdr yang berhubungan harus dinamakan image.hdr dan berada di direktori yang sama dengan file image.bil . Kemudian jika anda mengakses Layer ‣ Add Raster Layer , pilih file dan ini akan terbuka tanpa masalah.

Sering kali, file tidak dilengkapi dengan sebuah file asosiasi .hdr . Dalam kasus seperti ini, anda harus menciptakan file ini dengan tangan dan akan ditunjukkan di tutorial ini.

Mendapatkan data

Kita akan menggunakan AVHRR Global Land Cover Classification data dari Global Land Cover Facility sebagai contoh.

Dataset Lingkupan Global terdistribusi dalam file BSQ . Unduh dataset 1 Degree pixel resolution

For convenience, you may directly download a copy of the dataset from the link below:

gl-latlong-1deg-landcover.bsq.gz

Sumber Data [GLCF]

Prosedur

  1. Unzip and extract the .bsq file. On Windows, you may use the excellent 7-Zip utility to read and extract .gz file. You will see that you only have a .bsq file named gl-latlong-1deg-landcover.bsq. There is no hdr file.

../_images/1190.png
  1. Perhatikan jika anda mencoba untuk membuka file gl-latlong-1deg-landcover.bsq di QGIS secara langsung, anda akan mendapat pesan error.

../_images/2155.png
  1. Untuk mengatasi error ini, kita akan membuat sebuah file header dengan ekstensi .hdr . File header memiliki informasi tentang dataset dan bagaimana data terorganisasi. Biasanya, informasi ini tersupply sebagai bagian dari Metadata dataset. Jika anda tidak memilik metadat, lihat website atau dokumentasi untuk petunjuk. Beberapa informasi dapat diperkirakan jika anda tidak mengetahuinya. Dalam kasus dengan dataset seperti ini, link halaman untuk mengunduh metadata metadata . Unduh metadata dan buka.

../_images/389.png
  1. File .hdr harus dalam bentuk file teks murni dalam format berikut. Beberapa dari parameter sudah diberikan ke kita dan beberapa harus diolah terlebih dahulu. Learn more about the format.

ncols <number of columns or width of the raster>
nrows <number of rows or height of the raster>
cellsize <pixel size or resolution>
xllcorner <X coordinate of lower-left corner of the raster>
yllcorner <Y coordinate of the lower-left corner of the raster>
nodata_value <pixel value to be ignored>
nbits <number of bits per pixel>
pixeltype <type of values stored in a pixel, typically float or integer>
byteorder <byte order in which image pixel values are stored, msb or lsb>
  1. Open a text editor and create a file in the format specified in the previous step. Save the file as gl-latlong-1deg-landcover.hdr. Make sure the file doesn’t have .txt at the end. Some of the values in the text files are easy to understand. The ncols and nrows come from the metadata as the Number of Lines and Number of Pixels per Line. The cellsize is 1 as the Pixel resolution from the metadata. The X,Y coordinate of lower-left corner needs to be worked out by us. Since the file covers the entire World and units are lat/long, xllcorner and yllcorner are -180 and -90 respectively. We do not have any information about the nodata_value, so -9999 is a safe bet. From metadata again, Pixel Format is Byte, so nbits will equal to 8 and pixeltype will be byte_unsigned. We do not have information about the byteorder, so leave it as msbfirst. You may download the correctly formatted HDR file from here.

../_images/554.png
  1. Sekarang anda sudah punya file header, taruh file di direktori yang sama dengan gl-latlong-1deg-landcover.bsq . Kemudian di QGIS, akses Layer ‣ Add Raster Layer . Pilih gl-latlong-1deg-landcover.bsq sebagai input dan klik Open.

../_images/652.png
  1. Dalam layar berikutnya, anda akan dibawa untuk memilih sebuah CRS. Karena data dalam Lat/Long pilih WGS84 EPSG:4326 sebagai CRS anda. Sekarang anda akan melihat dataset yang terbuka di QGIS

../_images/751.png

If you want to report any issues with this tutorial, please comment below. (requires GitHub account)