2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

複数のGeotiffを1枚にマージして、かつ1バンドのみを取り出す

Posted at

こちらではgdal_merge.pyをつかって分割されたGeotiffをマージしました。

今回ここでやりたいことは、分割されているそれぞれのGeotiffに複数のバンドが格納されており、またそれぞれでデータタイプが異なるため、1枚のGeotiffにマージしつつ、バンドをごとのGeotiffを作成することです。

#gdalbuildvrtでvrtファイルを作成する
# -b でバンドを指定
gdalbuildvrt OUTPUT_b01.vrt -b 1 INPUT1.tif INPUT2.tif INPUT3.tif 
gdalbuildvrt OUTPUT_b02.vrt -b 2 INPUT1.tif INPUT2.tif INPUT3.tif 
gdalbuildvrt OUTPUT_b03.vrt -b 2 INPUT1.tif INPUT2.tif INPUT3.tif 

#gdal_translateでvrtファイルをtifに変換する
#band1をByteタイプでエクスポート
gdal_translate -co COMPRESS=LZW -co BIGTIFF=YES -ot Byte -a_nodata 0 OUTPUT_b01.vrt OUTPUT_b01.tif

#band2をInt16タイプでエクスポート
gdal_translate -co COMPRESS=LZW -co BIGTIFF=YES -ot Int16 -a_nodata 0 OUTPUT_b02.vrt OUTPUT_b02.tif

#band3をFloat32タイプでエクスポート
gdal_translate -co COMPRESS=LZW -co BIGTIFF=YES -ot Float32 -a_nodata 0 OUTPUT_b03.vrt OUTPUT_b03.tif

参考:gdal_translate, gdalbuildvrt

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?