The GRASS plugin provides access to GRASS GIS (see GRASS-PROJECT 文献とWeb参照) databases and functionalities. This includes visualization of GRASS raster and vector layers, digitizing vector layers, editing vector attributes, creating new vector layers and analysing GRASS 2D and 3D data with more than 400 GRASS modules.
このセクションではプラグインの機能とGRASSデータの管理と操作の例を紹介します。以下のメインの機能はGRASSプラグインを立ち上げた時にツールバーメニューで提供されています 。機能については sec_starting_grass に記述されています:
QGISでGRASS の機能を利用したりGRASS ベクタとラスタレイヤを表示するためには, プラグインマネージャのGRASSプラグインを選択する必要があります. メニュー Plugins ‣ Manage Plugins, でselect
GRASS を選び [OK] をクリックして下さい.
ここで 既存の GRASS LOCATION
( セクション sec_load_grassdata 参照 ) からラスタとベクタレイヤをロードできます. また新しい GRASS LOCATION
を QGIS (セクション 新しいGRASS LOCATIONの作成 参照) 作成したりいくつかのラスタやベクタデータを (セクション GRASS LOCATIONへデータをインポート 参照) GRASS ツールボックス (セクション GRASSツールボックス 参照) のすばらしい解析機能で使うためにインポートすることができます.
GRASS プラグインで,ツールバーメニューの上の適切なボタンをクリックしてベクタやラスタのレイヤをロードすることができます. 例として QGIS アラスカデータセット (セクション サンプルデータ 参照) を使えます. ここには小さめの GRASSサンプルとして LOCATION
として3 個のベクタレイヤと1個のラスタ標高マップがあります.
grassdata
, download the QGIS ‘Alaska’ dataset
qgis_sample_data.zip
from http://download.osgeo.org/qgis/data/
and unzip the file into grassdata
.QGISの起動.
もし事前のQGIS セッションで,GRASS プラグインをロードしていない場合は Plugins ‣ Manage Plugins をクリックして
GRASS を有効にして下さい. GRASS ツールバーが QGIS メインウィンドウに表示されます.
Gisdbase
browse and select or enter the path to the newly created
folder grassdata
.alaska
and the MAPSET demo
.gtopo30
and click [OK]. The elevation layer will be visualized.alaska
and click [OK]. The Alaska boundary vector layer will be
overlayed on top of the gtopo30
map. You can now adapt the layer
properties as described in chapter ベクタプロパティダイアログ, e.g.
change opacity, fill and outline color.その他の2つのベクタレイヤ rivers
and airports
をロードしてプロパティを調整して下さい.
ご覧になったようにGRASSのラスタとベクタレイヤをQGISにロードする方法はとても簡単です. 以下のセクションではGRASS データの編集と新しい LOCATION
の作成について記述されています . さらに多くのサンプル GRASS LOCATIONs
が GRASS ウェッブサイト http://grass.osgeo.org/download/sample-data/ にあります.
ちなみに
GRASSデータの読み込み
もしデータのロードに問題があったりQGISが異常終了するような場合,GRASSプラグインがセクション sec_starting_grass で記述されているように正しくロードされているかどうか確認して下さい.
GRASS data are stored in a directory referred to as GISDBASE. This directory often
called grassdata
, must be created before you start working with the GRASS
plugin in QGIS. Within this directory, the GRASS GIS data are organized by projects
stored in subdirectories called LOCATION
. Each LOCATION
is defined
by its coordinate system, map projection and geographical boundaries. Each
LOCATION
can have several MAPSETs
(subdirectories of the
LOCATION
) that are used to subdivide the project into different topics,
subregions, or as workspaces for individual team members (Neteler & Mitasova
2008 文献とWeb参照). In order to analyze vector and raster layers
with GRASS modules, you must import them into a GRASS LOCATION
(This is
not strictly true - with the GRASS modules r.external
and v.external
you can create read-only links to external GDAL/OGR-supported data sets without
importing them. But because this is not the usual way for beginners to work with
GRASS, this functionality will not be described here.).
Figure GRASS location 1:
ここに例として用意した GRASS LOCATION alaska
, は Albers正積投影でフィート単位で作成されているプロジェクトの QGISサンプルデータセットです. このサンプルThis sample GRASS LOCATION alaska
は次のGRASS GIS 関連の章で例と演習に使われます.これはダウンロードしてあなたのコンピュータにインストールできる便利なデータセットです サンプルデータ).
QGIS を起動して GRASS プラグインがロードされているかどうか確認して下さい.
QGISのアラスカデータセット:ref:label_sampledata から alaska.shp
shapefileを表示します (セクション vector_load_shapefile 参照) .
既存の GRASS データベース (GISDBASE) フォルダ grassdata
を選択するかあなたのコンピュータのファイルマネージャを使って新しい LOCATION
を作成して下さい. それから [Next] をクリックして下さい.
MAPSET
within an existing
LOCATION
(see section 新しいMAPSETの追加) or to create a new
LOCATION
altogether. Select LOCATION
- we used ‘alaska’ and click [Next].LOCATION
and
projection and haven’t memorized the EPSG ID, click on the [次へ] をクリックして下さい.
LOCATION
bounds in
north, south, east, and west direction. Here we simply click on the button
[Set current QGIS extent], to apply the extend of the loaded layer
alaska.shp
as the GRASS default region extend.[次へ] をクリックして下さい.
MAPSET
within our new LOCATION
. You
can name it whatever you like - we used ‘demo’ (when creating a new
LOCATION
). GRASS automatically creates a special MAPSET
called
PERMANENT
designed to store the core data for the project, its default
spatial extend and coordinate system definitions (Neteler & Mitasova 2008
文献とWeb参照).新しい LOCATION
‘alaska’ と2つの MAPSETs
‘demo’ と ‘PERMANENT’ が作られました. 現在オープンされているワーキングセットはあなたが定義した ‘demo’ です.
GRASSツールバーのそれまでは利用できなかったいくつかのツールが利用可能になっています.
Figure GRASS location 2:
If that seemed like a lot of steps, it’s really not all that bad and a very quick
way to create a LOCATION
. The LOCATION
‘alaska` is now ready for
data import (see section GRASS LOCATIONへデータをインポート). You can also use the already
existing vector and raster data in the sample GRASS LOCATION
‘alaska’
included in the QGIS ‘Alaska’ dataset サンプルデータ and move on to
Section GRASSベクターデータモデル.
ユーザは自分で作成した GRASS MAPSET
にのみ書き込み権限を持ちます. このことはユーザが自分の MAPSET
にアクセスできる一方で他のユーザの MAPSETs
も読むことができます,しかし変更や削除は自分の MAPSET
に対してのみ行えることを示します .
すべての MAPSETs
には WIND
ファイルが含まれ,そこには現在の領域の座標値と選択されているラスタの解像度が格納されています (Neteler & Mitasova 2008 文献とWeb参照, セクション :ref:`sec_grass_region`参照).
QGIS を起動して GRASS プラグインがロードされているかどうか確認して下さい.
さらに MAPSET
の ‘test’ をするため LOCATION
‘alaska’ の GRASS データベース (GISDBASE) フォルダ grassdata
を選択して下さい.
[次へ] をクリックして下さい.
MAPSET
within an existing
LOCATION
or to create a new LOCATION
altogether. Click on the
radio button text
for the new MAPSET
. Below in the wizard you
see a list of existing MAPSETs
and its owners.This Section gives an example how to import raster and vector data into the
‘alaska’ GRASS LOCATION
provided by the QGIS ‘Alaska’ dataset.
Therefore we use a landcover raster map landcover.img
and a vector GML
file lakes.gml
from the QGIS ‘Alaska’ dataset サンプルデータ.
QGIS を起動して GRASS プラグインがロードされているかどうか確認して下さい.
QGIS アラスカデータセットの中の grassdata
フォルダーをGRASSデータベースとして選択して下さい, LOCATION
を ‘alaska’ , MAPSET
を ‘demo’ として [OK] をクリックして下さい.
ここで Open GRASS tools アイコンをクリックして下さい. GRASS ツールボックス (セクション subsec_grass_toolbox 参照) ダイアログが表示されます.
ラスタマップ landcover.img
をインポートする場合 Modules Tree タブの r.in.gdal
モジュールをクリックして下さい. この GRASSモジュールは GDAL がサポートしているファイルをGRASS LOCATION
にインポートします. r.in.gdal
モジュールダイアログが表示されます.
raster
in the QGIS ‘Alaska’ dataset
and select the file landcover.img
.landcover_grass
and click
[Run]. In the Output tab you see the currently running GRASS
command r.in.gdal -o input=/path/to/landcover.img
output=landcover_grass
.landcover_grass
raster layer is now imported into GRASS and
will be visualized in the QGIS canvas.lakes.gml
, click the module
v.in.ogr
in the Modules Tree tab. This GRASS module allows
to import OGR supported vector files into a GRASS LOCATION
. The
module dialog for v.in.ogr
appears.gml
in the QGIS ‘Alaska’ dataset and select the
file lakes.gml
as OGR file.lakes_grass
and click [Run]. You
don’t have to care about the other options in this example. In the
Output tab you see the currently running GRASS command
v.in.ogr -o dsn=/path/to/lakes.gml output=lakes\_grass
.lakes_grass
vector layer is now imported into GRASS and will be
visualized in the QGIS canvas.デジタイズの前に GRASSベクターデータモデル を理解することは重要です.
基本的にGRASSではトポロジカルベクターモデルを使用します.
This means that areas are not represented as closed polygons, but by one or more boundaries. A boundary between two adjacent areas is digitized only once, and it is shared by both areas. Boundaries must be connected and closed without gaps. An area is identified (and labeled) by the centroid of the area.
Besides boundaries and centroids, a vector map can also contain points and lines. All these geometry elements can be mixed in one vector and will be represented in different so called ‘layers’ inside one GRASS vector map. So in GRASS a layer is not a vector or raster map but a level inside a vector layer. This is important to distinguish carefully (Although it is possible to mix geometry elements, it is unusual and even in GRASS only used in special cases such as vector network analysis. Normally you should prefere to store different geometry elements in different layers.).
It is possible to store several ‘layers’ in one vector dataset. For example, fields, forests and lakes can be stored in one vector. Adjacent forest and lake can share the same boundary, but they have separate attribute tables. It is also possible to attach attributes to boundaries. For example, the boundary between lake and forest is a road, so it can have a different attribute table.
The ‘layer’ of the feature is defined by ‘layer’ inside GRASS. ‘Layer’ is the number which defines if there are more than one layer inside the dataset, e.g. if the geometry is forest or lake. For now, it can be only a number, in the future GRASS will also support names as fields in the user interface.
Attributes can be stored inside the GRASS LOCATION
as DBase or SQLITE3 or
in external database tables, for example PostgreSQL, MySQL, Oracle, etc.
Attributes in database tables are linked to geometry elements using a ‘category’ value.
‘Category’ (key, ID) is an integer attached to geometry primitives, and it is used as the link to one key column in the database table.
ちなみに
GRASSベクターモデルについて調べる
GRASS ベクタモデルとその機能について学習する最良の方法はベクタモデルについてさらに深く記述されている GRASSチュートリアルをダウンロードすることです. http://grass.osgeo.org/documentation/manuals/ に様々な言語での本やチュートリアルが記述されています.
To create a new GRASS vector layer with the GRASS plugin click the
Create new GRASS vector toolbar icon.
Enter a name in the text box and you can start digitizing point, line or polygon
geometries, following the procedure described in Section GRASSベクタレイヤのデジタイジングと編集.
In GRASS it is possible to organize all sort of geometry types (point, line and area) in one layer, because GRASS uses a topological vector model, so you don’t need to select the geometry type when creating a new GRASS vector. This is different from Shapefile creation with QGIS, because Shapefiles use the Simple Feature vector model (see Section 新しいベクタレイヤの作成).
ちなみに
GRASSベクターレイヤーの属性テーブルを新規作成
デジタイズされたジオメトリ地物に属性を割り当てたい場合はデジタイズ作業を開始する前にテーブルとカラムを作る時に注意しなければいけません ( figure_grass_digitizing_5 参照 ).
The digitizing tools for GRASS vector layers are accessed using the
Edit GRASS vector layer icon on the toolbar. Make sure you
have loaded a GRASS vector and it is the selected layer in the legend before
clicking on the edit tool. Figure figure_grass_digitizing_2 shows the GRASS
edit dialog that is displayed when you click on the edit tool. The tools and
settings are discussed in the following sections.
ちなみに
GRASSポリゴンをデジタイズ
If you want to create a polygon in GRASS, you first digitize the boundary of the polygon, setting the mode to ‘No category’. Then you add a centroid (label point) into the closed boundary, setting the mode to ‘Next not used’. The reason is, that a topological vector model links attribute information of a polygon always to the centroid and not to the boundary.
ツールバー
In figure_grass_digitizing_1 you see the GRASS digitizing toolbar icons provided by the GRASS plugin. Table table_grass_digitizing_1 explains the available functionalities.
Figure GRASS digitizing 1:
表 GRASS デジタイジング 1: GRASS デジタイジングツール
カテゴリータブ
The Category tab allows you to define the way in which the category values will be assigned to a new geometry element.
Figure GRASS digitizing 2:
モード: どのカテゴリ値が新しいジオメトリエレメントに割り当てられるか.
次に使っていないもの - 次に使っていないカテゴリ値をジオメトリエレメントに割り当てます.
手動エントリ - ジオメトリエレメントに割り当てる値を ‘カテゴリ’-エントリフィールドで手動で定義します.
カテゴリ無し - ジオメトリエレメントにカテゴリ値を割り当てない. たとえばエリアの境界線,この場合カテゴリ値はセントロイドに結び付けられます.
カテゴリ - それぞれのデジタイズされたジオメトリエレメントに割り当てられた数値 (ID) . それぞれのジオメトリエレメントと属性を結合します.
フィールド (レイヤ) - それぞれのジオメトリエレメントは異なるGRASSジオメトリレイヤを使って様々な属性テーブルに結合できます. デフォルトレイヤ番号は1です.
ちなみに
GRASS ‘layer’ をQGISに追加して作成
もしさらに多くのレイヤをデータセットに追加したい場合 ‘Field (layer)’ エントリボックスに新しい数字を追加すればいいです. テーブルタブで新しいレイヤに結合するテーブルを作成できます.
選択タブ
The Settings tab allows you to set the snapping in screen pixels. The threshold defines at what distance new points or line ends are snapped to existing nodes. This helps to prevent gaps or dangles between boundaries. The default is set to 10 pixels.
Figure GRASS digitizing 3:
シンボルタブ
The Symbology tab allows you to view and set symbology and color settings for various geometry types and their topological status (e.g. closed / opened boundary).
Figure GRASS digitizing 4:
テーブルタブ
The Table tab provides information about the database table for a given ‘layer’. Here you can add new columns to an existing attribute table, or create a new database table for a new GRASS vector layer (see Section 新しいGRASSベクターレイヤーの作成).
Figure GRASS digitizing 5:
ちなみに
GRASS編集権限
編集を行いたい場合あなたは GRASS MAPSET
のオーナーにならなければいけません. あなたが所有する以外の MAPSET
に属するレイヤはファイルに書き込み権限を持っていても編集できません.
The region definition (setting a spatial working window) in GRASS is important
for working with raster layers. Vector analysis is by default not limited to any
defined region definitions. But all newly-created rasters will have the spatial
extension and resolution of the currently defined GRASS region, regardless of
their original extension and resolution. The current GRASS region is stored in
the $LOCATION/$MAPSET/WIND
file, and it defines north, south, east and
west bounds, number of columns and rows, horizontal and vertical spatial resolution.
It is possible to switch on/off the visualization of the GRASS region in the QGIS
canvas using the Display current GRASS region button.
With the Edit current GRASS region icon you can open
a dialog to change the current region and the symbology of the GRASS region
rectangle in the QGIS canvas. Type in the new region bounds and resolution and
click [OK]. It also allows to select a new region interactively with your
mouse on the QGIS canvas. Therefore click with the left mouse button in the QGIS
canvas, open a rectangle, close it using the left mouse button again and click
[OK].
The GRASS module g.region
provide a lot more parameters to define an
appropriate region extend and resolution for your raster analysis. You can use
these parameters with the GRASS Toolbox, described in Section GRASSツールボックス.
The Open GRASS Tools box provides GRASS module functionalities
to work with data inside a selected GRASS
LOCATION
and MAPSET
.
To use the GRASS toolbox you need to open a LOCATION
and MAPSET
where you have write-permission (usually granted, if you created the MAPSET
).
This is necessary, because new raster or vector layers created during analysis
need to be written to the currently selected LOCATION
and MAPSET
.
Figure GRASS toolbox 1:
The GRASS Shell inside the GRASS Toolbox provides access to almost all (more than 330) GRASS modules through a command line interface. To offer a more user friendly working environment, about 200 of the available GRASS modules and functionalities are also provided by graphical dialogs within the GRASS plugin Toolbox.
The GRASS Shell inside the GRASS Toolbox provides access to almost all (more than 300) GRASS modules in a command line interface. To offer a more user friendly working environment, about 200 of the available GRASS modules and functionalities are also provided by graphical dialogs.
A complete list of GRASS modules available in the graphical Toolbox in QGIS version 2.0 is available in the GRASS wiki (http://grass.osgeo.org/wiki/GRASS-QGIS_relevant_module_list).
GRASS ツールボックスの内容をカスタマイズできます. この機能は セクション GRASSツールボックスのカスタマイズ に記述されています.
As shown in figure_grass_toolbox_1 , you can look for the appropriate GRASS module using the thematically grouped Modules Tree or the searchable Modules List tab.
Clicking on a graphical module icon a new tab will be added to the toolbox dialog providing three new sub-tabs Options, Output and Manual.
オプション
The Options tab provides a simplified module dialog where you can usually select a raster or vector layer visualized in the QGIS canvas and enter further module specific parameters to run the module.
Figure GRASS module 1:
The provided module parameters are often not complete to keep the dialog clear. If you want to use further module parameters and flags, you need to start the GRASS Shell and run the module in the command line.
QGIS 1.8 からの新しい機能として Options タブの簡素化ダイアログの下の show advanced options ボタンがあります. 現状で v.in.ascii モジュールの例としての使用が追加されているだけですが, しかし将来のバージョンのQGISでは GRASSツールボックスにさらに多くの機能が追加されるでしょう. このことによってGRASSの完全なモジュールがGRASSシェルに切り替えしなくても利用できるようになるでしょう.
出力
Figure GRASS module 2:
The Output tab provides information about the output status of the
module. When you click the [Run] button, the module switches to the
Output tab and you see information about the analysis process. If
all works well, you will finally see a Successfully finished
message.
マニュアル
Figure GRASS module 3:
The Manual tab shows the HTML help page of the GRASS module. You can
use it to check further module parameters and flags or to get a deeper knowledge
about the purpose of the module. At the end of each module manual page you see
further links to the Main Help index
, the Thematic index
and the
Full index
. These links provide the same information as if you use the
module g.manual
.
ちなみに
結果をすぐ表示
もし計算結果をすぐにマップキャンバスに表示したい場合モジュールタブの一番下にある ‘View Output’ ボタンを利用できます.
以下の例はいくつかの GRASS モジュールの力をデモンストレートします.
The first example creates a vector contour map from an elevation raster (DEM).
Assuming you have the Alaska LOCATION
set up as explained in Section
GRASS LOCATIONへデータをインポート.
gtopo30
elevation raster by clicking
gtopo30
raster from the demo location.gtopo30
raster should appear as
the Name of input raster.ctour_100
.Successfully finished
appears in the output window. Then click [View Output]
and [Close].Since this is a large region, it will take a while to display. After it finishes rendering, you can open the layer properties window to change the line color so that the contours appear clearly over the elevation raster, as in ベクタプロパティダイアログ.
Next zoom in to a small mountainous area in the center of Alaska. Zooming in close you will notice that the contours have sharp corners. GRASS offers the v.generalize tool to slightly alter vector maps while keeping their overall shape. The tool uses several different algorithms with different purposes. Some of the algorithms (i.e. Douglas Peuker and Vertex reduction) simplify the line by removing some of the vertices. The resulting vector will load faster. This process will be used when you have a highly detailed vector, but you are creating a very small scale map, so the detail is unnecessary.
ちなみに
シンプル化ツール
Note that the QGIS fTools plugin has a Simplify geometries ‣ tool that works just like the GRASS v.generalize Douglas-Peuker algorithm.
However, the purpose of this example is different. The contour lines created by
r.contour
have sharp angles that should be smoothed. Among the v.generalize
algorithms there is Chaikens which does just that (also Hermite splines). Be
aware that these algorithms can add additional vertices to the vector,
causing it to load even more slowly.
Successfully finished
appears in
the output windows, click [View output] and then [close].Figure GRASS module 4:
ちなみに
その他にr.contourも使えます
The procedure described above can be used in other equivalent situations. If you have a raster map of precipitation data, for example, then the same method will be used to create a vector map of isohyetal (constant rainfall) lines.
Several methods are used to display elevation layers and give a 3D effect to maps. The use of contour lines as shown above is one popular method often chosen to produce topographic maps. Another way to display a 3D effect is by hillshading. The hillshade effect is created from a DEM (elevation) raster by first calculating the slope and aspect of each cell, then simulating the sun’s position in the sky and giving a reflectance value to each cell. Thus you get sun facing slopes lighted and the slopes facing away from the sun (in shadow) are darkened.
gtopo30
elevation raster. Start the GRASS
toolbox and under the Raster category double click to open Spatial analysis
‣ Terrain analysis.それからモジュールをオープンするために r.shaded.relief をクリックして下さい.
新しいヒルシェードラスタとして gtopo30_shade
と入力して [Run] をクリックして下さい.
プロセスが完了するとヒルシェードラスタが地図に追加されます.これはグレイスケールで表示されます.
gtopo30
together shift
the hillshade map below the gtopo30
map in the table of contents, then open
the Properties window of gtopo30
, switch to the
transparency tab and set its transparency level to about 25%.You should now have the gtopo30
elevation with its colormap and transparency
setting displayed above the grayscale hillshade map. In order to see the
visual effects of the hillshading, turn off the gtopo30_shade
map, then turn
it back on.
GRASS shellの使用
The GRASS plugin in QGIS is designed for users who are new to GRASS, and not familiar with all the modules and options. As such, some modules in the toolbox do not show all the options available, and some modules do not appear at all. The GRASS shell (or console) gives the user access to those additional GRASS modules that do not appear in the toolbox tree, and also to some additional options to the modules that are in the toolbox with the simplest default parameters. This example demonstrates the use of an additional option in the r.shaded.relief module that was shown above.
Figure GRASS module 5:
The module r.shaded.relief can take a parameter zmult
which multiplies
the elevation values relative to the X-Y coordinate units so that the hillshade
effect is even more pronounced.
gtopo30
elevation raster as above, then start the GRASS toolbox
and click on the GRASS shell. In the shell window type the command
r.shaded.relief map=gtopo30 shade=gtopo30_shade2 azimuth=315 zmult=3
and
press [Enter].gtopo30_shade2
raster to display in QGIS.Figure GRASS module 6:
The next example shows how a GRASS module can aggregate raster data and add columns of statistics for each polygon in a vector map.
shapefiles
directory into GRASS.ツールボックスで Vector ‣ Manage features, を選択して v.centroids モジュールを開いて下さい.
forest_areas
vector and display the types of forests - deciduous,
evergreen, mixed - in different colors: In the layer Properties
window, Symbology tab, choose from Legend type
次に GRASS ツールボックスを再オープンして Vector ‣ Vector update を他の地図で開いて下さい.
v.rast.stats モジュールをクリックして. gtopo30
, と forest_areas
と入力して下さい.
elev
,
and click [run]. This is a computationally heavy operation which will run
for a long time (probably up to two hours).forest_areas
attribute table, and verify that several new
columns have been added including elev_min
, elev_max
, elev_mean
etc. for each forest polygon.Another useful feature inside the GRASS Toolbox is the GRASS LOCATION
browser. In figure_grass_module_7 you can see the current working LOCATION
with its MAPSETs
.
In the left browser windows you can browse through all MAPSETs
inside the
current LOCATION
. The right browser window shows some meta information
for selected raster or vector layers, e.g. resolution, bounding box, data source,
connected attribute table for vector data and a command history.
Figure GRASS module 7:
The toolbar inside the Browser tab offers following tools to manage
the selected LOCATION
:
The Rename selected map and
Delete selected map only work with maps inside your currently selected
MAPSET
. All other tools also work with raster and vector layers in
another MAPSET
.
Nearly all GRASS modules can be added to the GRASS toolbox. A XML interface is provided to parse the pretty simple XML files which configures the modules appearance and parameters inside the toolbox.
A sample XML file for generating the module v.buffer
(v.buffer.qgm) looks
like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE qgisgrassmodule SYSTEM "http://mrcc.com/qgisgrassmodule.dtd">
<qgisgrassmodule label="Vector buffer" module="v.buffer">
<option key="input" typeoption="type" layeroption="layer" />
<option key="buffer"/>
<option key="output" />
</qgisgrassmodule>
The parser reads this definition and creates a new tab inside the toolbox when you select the module. A more detailed description for adding new modules, changing the modules group, etc. can be found on the QGIS wiki at http://hub.qgis.org/projects/quantum-gis/wiki/Adding_New_Tools_to_the_GRASS_Toolbox