More Related Content Similar to 131101 foss4 g_tokyo_grass_shell_presentation
Similar to 131101 foss4 g_tokyo_grass_shell_presentation (20) More from Takayuki Nuimura
More from Takayuki Nuimura (20) 131101 foss4 g_tokyo_grass_shell_presentation2. Shell script とは
Demo
Shell script とは
様々なコマンドライン処理をスクリプト (*.sh) に記述することで、
コマンド郡を一括処理ができる
CUI インターフェースを持つソフトウェアの処理を連携
Shell script
2/5
4. Shell script とは
Demo
Demo 1: DEM =⇒ 等高線 (GDAL/OGR) =⇒ 表示 (QGIS)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dem_files=$(ls *dem*.tif)
intervals=(100 200 1000)
for dem in ${dem_files}; do
echo "Proessing "${dem}
for interval in ${intervals[@]}; do
echo "Generating "${interval}" m interval"
contour=${dem%.tif}_ctr${interval}.shp
gdal_contour -i ${interval} ${dem} ${contour}
done
done
qgis $(ls *ctr*.shp)
4/5
5. Shell script とは
Demo
Demo 2: DEM =⇒ 傾斜 (GRASS) =⇒ 表示 (QGIS)
1
2
3
4
5
6
7
8
9
10
11
dem=srtm_dem30.tif
slope=srtm_slope30.tif
r.in.gdal input=${dem}
output=temp_dem
g.region rast=temp_dem
r.slope.aspect elevation=temp_dem slope=temp_slope
r.out.gdal -c input=temp_slope output=${slope}
g.mremove -f rast=temp* vect=temp*
qgis ${slope}
5/5