Skip to content

Instantly share code, notes, and snippets.

@nyampire
Created December 24, 2022 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyampire/c5ae2fd8d4a86001448923dde84c2382 to your computer and use it in GitHub Desktop.
Save nyampire/c5ae2fd8d4a86001448923dde84c2382 to your computer and use it in GitHub Desktop.
オープンデータ航空写真のタイル化メモ
# unzipして、orthoディレクトリをつくる
unzip ./'*.zip'
mkdir ortho
# mvで、tifとtfwをortho配下に移動
find . -type f -name "*.tf*" -exec mv {} ./ortho \;
find . -type f -name "*.tif" -exec mv {} ./ortho \;
cd ./ortho
# vrtファイルを作って、EPSG変換
gdalbuildvrt merge.vrt ./*tif
gdalwarp -s_srs EPSG:6677 -t_srs EPSG:3857 merge.vrt ./EPSG3857.vrt
gdal_translate -of VRT -ot Byte -scale EPSG3857.vrt temp.vrt
# タイル化のテスト。出力先は../tiles
gdal2tiles.py -z10 --xyz EPSG3857.vrt ../tiles
# サンプルみてみて問題無さそうなら全部出力して、サンプル確認
gdal2tiles.py -z11-19 --xyz EPSG3857.vrt ../tiles
open ../tiles/
# 航空写真が含まれていない、カラのタイルファイルを削除
cd ../tiles
find ./* -type f -size -1700c -exec rm -f {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment