この夏のメモ(GRASS奮闘)

リナックスコマンドの覚書

面積計算など

2010-01-19 08:50:42 | Work Note
長さの場合
Dim pGeo As IGeometry
Set pGeo = [Shape]
Dim pPolyline As IPolyline
Set pPolyline = pGeo
Dim pCurve As IPolycurve
Set pCurve = pPolyline
出力先 pCurve.Length

周長の場合
Dim pGeo As IGeometry
Set pGeo = [Shape]
Dim pPolygon As IPolygon
Set pPolygon = pGeo
出力先 pPolygon.Length

面積の場合
Dim pGeo As IGeometry
Set pGeo = [Shape]
Dim pPolygon As IPolygon
Set pPolygon = pGeo
Dim pArea As IArea
Set pArea = pPolygon
出力先 pArea.Area

unsurpervised classification example

2010-01-15 22:57:29 | GRASS
g.region vect=nyuukawa@PERMANENT res=10
v.to.rast input=nyuukawa@PERMANENT output=nyuukawa use=cat layer=1 value=1 rows=4096 --overwrite
r.mask -o input=nyuukawa maskcats=*
r.mapcalc "NDVI=1.0*(spot5.4@PERMANENT-spot5.3@PERMANENT)/(spot5.4@PERMANENT+spot5.3@PERMANENT)"
r.mapcalc "ndvi_mask=if(NDVI>-0.1,1,null())"
r.mask -o input=ndvi_mask maskcats=*
i.group group=spot5 subgroup=spot5 input=spot5.1@PERMANENT,spot5.2@PERMANENT,spot5.3@PERMANENT,spot5.4@PERMANENT
i.cluster group=spot5 subgroup=spot5 sigfile=nyuukawa_sig classes=15 iterations=30 convergence=98.0 separation=0.0 min_size=17 reportfile=nyuukawa_rep
i.maxlik group=spot5 subgroup=spot5 sigfile=nyuukawa_sig class=nyuukawa_results reject=nyuukawa_rej
r.out.tiff -p -t input=nyuukawa_results output=/home/takejima/spot5_hida_nn/nyuukawa compression=none
cat kamitakara_class.txt | r.reclass kamitakara_results out=kamitakara_fin --o
r.out.tiff -t input=kamitakara_fin output=/home/takejima/spot5_hida_nn/kamitakara_fin compression=none



nyuukawa_class.txt
1 thru 6 = 20 conifer
7 = 21 urban1
8 thru 9 =22 broad
10 = 23 urban2
11 = 22 broad
12 = 24 grass
13 thru 15 = 22 broad