131101 foss4 g_tokyo_grass_shell_presentation

5

Click here to load reader

Upload: takayuki-nuimura

Post on 30-Jun-2015

136 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: 131101 foss4 g_tokyo_grass_shell_presentation

Shell script とは Demo

Shell scriptで FOSS4G連携

縫村崇行 1,2

(NUIMURA, Takayuki)

1 名古屋大学

2OSGeo 財団日本支部

2013/11/01

1 / 5

Page 2: 131101 foss4 g_tokyo_grass_shell_presentation

Shell script とは Demo

Shell scriptとは

様々なコマンドライン処理をスクリプト (*.sh)に記述することで、コマンド郡を一括処理ができる

CUIインターフェースを持つソフトウェアの処理を連携

Shell script

2 / 5

Page 3: 131101 foss4 g_tokyo_grass_shell_presentation

Shell script とは Demo

OS (ここでは Linux)が持つコマンド + FOSS4Gコマンド⇓

大量の GISデータの一括処理

解析パラメータを徐々に変えて一括処理

3 / 5

Page 4: 131101 foss4 g_tokyo_grass_shell_presentation

Shell script とは Demo

Demo 1: DEM =⇒等高線 (GDAL/OGR) =⇒表示 (QGIS)

1 dem_files=$(ls *dem*.tif)2 intervals=(100 200 1000)34 for dem in ${dem_files}; do5 echo "Proessing "${dem}67 for interval in ${intervals[@]}; do8 echo "Generating "${interval}" m interval"910 contour=${dem%.tif}_ctr${interval}.shp11 gdal_contour -i ${interval} ${dem} ${contour}12 done13 done1415 qgis $(ls *ctr*.shp)

4 / 5

Page 5: 131101 foss4 g_tokyo_grass_shell_presentation

Shell script とは Demo

Demo 2: DEM =⇒傾斜 (GRASS) =⇒表示 (QGIS)

1 dem=srtm_dem30.tif2 slope=srtm_slope30.tif34 r.in.gdal input=${dem} output=temp_dem5 g.region rast=temp_dem6 r.slope.aspect elevation=temp_dem slope=temp_slope7 r.out.gdal -c input=temp_slope output=${slope}89 g.mremove -f rast=temp* vect=temp*1011 qgis ${slope}

5 / 5