ベクタレイヤの レイヤプロパティ ダイアログはそのレイヤのンボロジの設定とラべリングオプション情報を提供します.あなたのベクタレイヤが PostgreSQL/PostGISデータストアからロードされたものならば 一般情報 タブの クエリビルダ ダイアログを使って元になるSQLを変更することができます. レイヤプロパティ ダイアログにアクセスするためには凡例でレイヤをダブルクリックするかマウス右ボタンクリックでポップアップメニューから プロパティ を選択して下さい.
Figure Vector Properties 1:
スタイルメニューではベクタデータをレンダリングとシンボライジングを行うための包括的ツールを提供します. Layer rendering ‣ ツールはすべてのベクタデータに対して共通で利用でき異なる種類のベクタデータ向けの特別シンボライズツールもあります.
レイヤ透過性 : このツールによって地図キャンパスにおけるレイヤの可視性を設定できます. このスライダでベクタレイヤの可視性を調整できます. メニューの横にあるスライダを使ってレイヤの表示比率を定義することができますr.
レイヤ混合モード: を使うと今までグラフィックプログラムでしか利用できなかったようなすばらしい描画エフェクトを利用することができます.上書きされるレイヤと下に描画されるレイヤのピクセルを下記のような方法で混ぜることができます.
通常: これは標準的な混合モードでトップピクセルのアルファチャンネルを使い下のピクセルと混合します; 色は混合されません
明るく: この場合フォアグランドとバックグラウンドのピクセルからそれぞれのコンポーネントの最大値を選択します. この結果はギザギザや極端な場合があることに注意して下さい.
Screen: ソースのライトピクセルが書き込み先の上の書き込まれます, 一方ダークピクセルは書き込まれません. このモードはあるレイヤの模様を他のレイヤに混ぜたい場合便利です. たとえば標高陰影を他のレイヤに重ねる場合利用できます
覆い焼き: 覆い焼きはトップレベルピクセルの明るさのレベルを基にして下のピクセルの明度をあげ彩度をあげます.ですからトップピクセルが明るくなると下のピクセルの彩度と明度があがります. トップピクセルがそんなに明るくない場合エフェクトは強くかかりうまく動作します.
加算: この混合モードはあるレイヤのピクセル値を単純に他のレイヤに加算します. 値が1以上の場合 (RGBの場合), 白が表示されます. このモードは地物をハイライトさせたい場合に適しています.
暗く:前景色と背景のピクセルの最小の構成要素を保持して生じたピクセルを作成します。明るくのような、結果がギザギザと厳しくなりがちです。
乗算:これは、最下レイヤに対応するピクセルと最上レイヤの各ピクセルの数値を乗算します。結果は暗いピクチャです。
焼き込み:最上レイヤにある暗い色は、下のレイヤが暗くなります。下にあるレイヤを微調整し、色の強調に使用することができます。
オーバーレイ:乗算と網掛けモードを組み合わせたものです。ピクチャのライトパーツの軽量化の結果、明るい部分はより明るくなり、暗い部分がより暗くなります。
ソフトライト:オーバーレイに非常に似ていますが、乗算/覆い焼きの代わりに、色の焼き込み/ダッジを使用しています。この1つは画像の上に柔らかな光が輝いてエミュレートすることになっています。
ハードライト:ハードライトはオーバーレイモードと非常によく似ています。これは、画像に非常に強い光を投影しエミュレートすることになっています。
差分:差分は、下のピクセルまたは周囲の別のものから上のピクセルを減算し、正の値を取得します。すべてのカラーが0であるため、黒とプレンドしても何も変化しません。
Since QGIS 2.0 the old symbology is no longer available. In this version the new symbology has been redesigned and revised.
The renderer is responsible for drawing a feature together with the correct symbol. There are four types of renderers: single symbol, categorized, graduated and rule-based. There is no continuous color renderer, because it is in fact only a special case of the graduated renderer. The categorized and graduated renderer can be created by specifying a symbol and a color ramp - they will set the colors for symbols appropriately. For point layers there is a point displacement renderer available. For each data type (points, lines and polygons) vector symbol layer types are available. Depending on the chosen renderer, the Style menu provides different following sections. On the bottom right of the symbology dialog there is a [Symbol] button which gives access to the Style Manager (see Section vector_style_manager). The Style Manager allows you to edit and remove existing symbols and add new ones.
ちなみに
複数シンボルを選択して変更する
シンボロジでは複数のシンボルを選択して右クリックでそれらの色,透過度,サイズや太さを変更できます.
単一シンボルレンダラ
The Single Symbol Renderer is used to render all features of the layer using a single user-defined symbol. The properties, that can be adjusted in the Style menu, depend partially on the type of the layer, but all types share the following structure. In the top left part of the menu, there is a preview of the current symbol to be rendered. On the right part of the menu, there is a list of symbols already defined for the current style, prepared to be used via selecting them from the list. The current symbol can be modified using the menu on the right side.
If you click on the first level in the Symbol layers dialog on the left side it’s possible to define basic parameters like Size, Transparency, Color and Rotation. Here the layers are joined together.
Figure Symbology 1:
さらに詳細な設定は第2レベルの Symbol layers の中をクリックすると実行できます. 後で一体化される Symbol layers を定義できます. シンボルはいくつかの Symbol layers で構成することができます. 以下の設定が可能です:
Symbol layer type: ここでは楕円マーカー, フォントマーカー, シンプルマーカー, SVGマーカーとベクタフィールドマーカーを利用できます
大きさ
回転
色
太さ
オフセット X,Y: X方向またはY方向にシンボルの位置をずらすことができます
Note that once you have set the size in the lower levels the size of the whole symbol
can be changed with the Size menu in the first level again. The size of
the lower levels changes accordingly while the size ratio is maintained.
After having done any needed changes, the symbol can be added to the list of
current style symbols (using the [Symbol] Save in symbol library)
and then easily be used in the future. Furthermore you can use the [Save Style]
button to
save the symbol as a QGIS layer style file (.qml) or SLD file(.sld). Currently
in version 2.0 SLDs can be exported from any type of renderer: single symbol,
categorized, graduated or rule-based, but when importing an SLD, either a
single symbol or rule-based renderer is created.
That means that categorized or graduated styles are converted to rule-based.
If you want to preserve those renderers, you have to stick to the QML format.
On the other hand, it could be very handy sometimes to have this easy way of
converting styles to rule-based.
With the Style manager from the [Symbol] menu you can administrate your
symbols. You can
add item,
edit item,
remove item
and
share item. ‘Marker’ symbols, ‘Line’ symbols, ‘Fill’ patterns and ‘Color ramps’
can be used to create the symbols (see defining_symbols). The symbols are assigned to ‘All Symbols’,
‘Groups’ or ‘Smart groups’ then.
カテゴライズドレンダラ
カテゴライズドレンダラはレイヤのすべての地物を単一のユーザ指定シンボルを使って選択地物の属性の値によって決められる色で描画します. スタイル メニューで選択できます:
属性(カラムリストボックスを利用)
シンボル(シンボルダイアログを利用)
色(カラーランプリストボックスを利用)
ダイアログの右下にある [Advanced] ボタンを使うとフィールドに回転角とサイズ,スケールの情報を格納できます. メニューの中央のリストにはシンボルレンダリングのために選択されている属性値がリストされます.
figure_symbology_2 では QGIS サンプルデータセットの riversレイヤを使ったカテゴリレンダリングダイアログの例が表示されています.
Figure Symbology 2:
You can create a custom color ramp choosing New color ramp... from the Color ramp dropdown menu. A dialog will prompt for the ramp type: Gradient, Random, ColorBrewer, and cpt-city. The first three have options for number of steps and/or multiple stops in the color ramp. See figure_symbology_3 for an example of custom color ramp and figure_symbology_3a for the cpt-city dialog.
Figure Symbology 3:
The cpt-city option opens a new dialog with hundreds of themes included ‘out of the box’.
Figure Symbology 3a:
グラヂュエイデッドレンダラ
グラデュエイデドレンダラはレイヤのすべての地物をユーザ指定単一シンボルで選択地物の属性値を区分することで色分けして描画します.
Figure Symbology 4:
カテゴライズレンダラと同じようにここでは回転とサイズスケールの値を特定のカラムに定義できます.
カテゴライズドレンダラと同じように スタイル タブで選択できます:
属性(カラムリストボックスを利用)
シンボル(シンボルプロパティボタンを利用)
色(カラーランプリストを利用)
さらにクラスの数とクラス内で地物をどのように分類するか(モードメニューを使用)指定できます.利用できるモードは次のとおりです:
等間隔
変位値
自然なブレイク (Jenks)
標準偏差
プリティブレイク
The listbox in the center part of the Style menu lists the classes together with their ranges, labels and symbols that will be rendered.
The example in figure_symbology_4 shows the graduated rendering dialog for the rivers layer of the QGIS sample dataset.
ルールベースレンダリング
The rule-based renderer is used to render all the features from a layer, using rule based symbols, whose color reflects the classification of a selected feature’s attribute to a class. The rules are based on SQL statements. The dialog allows rule grouping by filter or scale and you can decide if you want to enable symbol levels or use only first matched rule.
figure_symbology_5 の例は QGIS サンプルデータセットのリバーレイヤを利用したルールベースドレンダリングダイアログです.
To create a rule, activate an existing row by clicking on it or click on ‘+’ and
click on the new rule. Then press the [Edit rule] button. In the Rule
properties dialog you can define a label for the rule. Press the
button to open the Expression builder. In the Function List, click on
Fields and Values to view all attributes of the attribute table to
be searched. To add an attribute to the Field calculator Expression field,
double click its name in the Fields and Values list. Generally you
can use the various fields, values and functions to construct the calculation
expression or you can just type it into the box (see フィールド計算機).
Figure Symbology 5:
ポイント移動
The point displacement renderer offers to visualize all features of a point layer, even if they have the same location. To do this, the symbols of the points are placed on a displacement circle around a center symbol.
Figure Symbology 6:
ちなみに
ベクタシンボロジーのエキスポート
You have the possibility to export vector symbology from QGIS into the Google .kml, *.dxf and MapInfo.tab files. Just open the right mouse menu of the layer and click on Save selection as ‣ to define the name of the output file and its format. Use the Symbology export menu to save the symbology either as Feature symbology ‣ or as Symbol layer symbology ‣. If you have used symbol layers it is recommended to use the second setting.
The Labels core application provides smart
labeling for vector point, line and polygon layers and only requires a
few parameters. This new application also supports on-the-fly transformated layers.
The core functions of the application have been redesigned. In QGIS 2.0.
there are now a number of other features which improve the labeling. The following menus
have been created for labeling the vector layers:
テキスト
整形
バッファ
背景
影
配置
描画
新しいメニューが多彩なベクタレイヤでどのように利用されるか見てみましょう.
ポイントレイヤのラベリング
Start QGIS and load a vector point layer. Activate the layer in the legend and click on the
Layer Labeling Options icon in the QGIS toolbar menu.
最初に このレイヤのラベル チェックボックスをアクティブにしてラベル表示を行いたい属性カラムを選択して下さい. もしラベル表示に条件式を使いたい場合は
をクリックして下さい.
以下のステップは ドロップダウンメニューの次にある データ定義上書き 機能使わない場合のシンプルなラベル出力の説明です.
You can define the text style in the Text menu (see Figure_labels_1 ). A new function is the Type case option where you can influence the text rendering. You have the possibility to render the text ‘All uppercase’, ‘All lowercase’ or ‘Capitalize first letter’. Also, a new function in QGIS 2.0 is the use of blend modes (see blend_modes).
In the Formatting menu you can define a character for a line break in the labels with the wrap label on character function.
Use the Formatted numbers option to format the numbers in an attribute table. Here
decimal places are inserted. If you enable this option three decimal places ist set by default.
To create a buffer just activate Draw text buffer checkbox in the Buffer menu.
The buffer color is variable. Also, a new function in QGIS 2.0 is the use of blend modes (see blend_modes).
If the Color buffer’s fill checkbox is activated, it will interact with partially transparent
text and give mixed color transparency results. Turning off the buffer fill fixes that issue (except where the interior
aspect of the buffer’s stroke intersects with the text’s fill) and also allows the user to make outlined text.
In the Background menu you can define with Size X and Size Y the shape of your background. Use Size type to insert an additional ‘Buffer’ into your background. The buffer size one is set by default here. The background then consists of the buffer plus the background in Size X and Size Y. You can set a Rotation where you can choose between ‘Sync with label’, ‘Offset of label’ and ‘Fixed’. Using ‘Offset of label’ and ‘Fixed’ you can rotate the background. Define an Offset X,Y with X and Y values and the background will be shifted. When applying Radius X,Y the background gets rounded corners. Again, it is possible to mix the background with the underlying layers in the map canvas using the Blend mode (see blend_modes).
Use the Shadow menu for a user-defined Drop shadow. The drawing of the background is very variable.
Choose between ‘Lowest label component’, ‘Text’, ‘Buffer’ and ‘Background’. The Offset angle depends on the orientation
of the label. If you choose the Use global shadow checkbox then the zero point of the angle is
always oriented to the north and doesn’t depend on the orientation of the label. Influence the appearance of the shadow
with the Blur radius. The higher the number, the softer the shadows.
The appearance of the drop shadow can also be altered by choosing a blend mode (see blend_modes).
Choose the Placement menu for the label placement and the labeling priority. Using the
Offset from point setting you now have the possibility to use Quadrants
to place your label. Additionally you can alter the angle of the label placement with the Rotation setting.
Thus, a placement in a certain quadrant with a certain rotation is possible.
In the Rendering menu you can define label and feature options. In the Label options
you find the scale-based visibility setting now. You can prevent QGIS from rendering only selected labels with
the Show all labels for this layer (including colliding labels) checkbox.
In the Feature options you can define if every part of a multipart feature is to be labeled. In QGIS 2.0 now it’s possible to define
if the number of features to be labeled is limited and to
Discourage labels from covering features.
Figure Labels 1:
ラインレイヤのラベリング
First step is to activate the Label this layer checkbox
in the Label settings tab and select an attribute column to use for
labeling. Click
if you
want to define labels based on expressions.
After that you can define the text style in the Text menu. Here the same settings as for point layers are possible.
Also in the Formatting menu the same settings as for point layers are possible.
The Buffer menu has the same functions as described in section labeling_point_layers .
The Background menu has the same entries as described in section labeling_point_layers .
Also the Shadow menu has the same entries as described in section labeling_point_layers .
In the Placement menu you find special settings for line layers. The label can be placed
Parallel,
Curved or
Horizontal.
With the
Parallel and
Curved option come the following settings:
You can define the position
Above line,
On line
and
Below line. It’s possible to select several options at once.
QGIS will look for the optimal position of the label then. Remember that here you can
also use the line orientation for the position of the label.
Additionally you can define a Maximum angle between curved characters when
selecting the
Curved option (see Figure_labels_2 ).
The Rendering menu has nearly the same entries as for point layers. In the Feature options you can now Suppress labeling of features smaller than.
Figure Labels 2:
ポリゴンレイヤのラベリング
First step is to activate the Label this layer checkbox
and select an attribute column to use for labeling. Click
if you
want to define labels based on expressions.
In Text menu define the text style. The entries are the same as for point and line layers.
The Formatting menu allows you to format multiple lines like for point and line layers.
As with point and line layers you can create a text buffer in the Buffer menu.
Use the Background menu to create a complex user-defined background for the polygon layer. You can use the menu as well as for the point and line layers.
The entries in the Shadow menu are the same as for point and line layers.
In the Placement menu you find special settings for polygon layers (see Figure_labels_3 ).
Offset from centroid,
Horizontal (slow),
Around centroid,
Free and
Using perimeter are possible.
In the Offset from centroid settings you can define if the centroid
is
visible polygon or
whole polygon.
That means that either the centroid is used for the polygon you can see on the map or the centroid is
used for the whole polygon, no matter if you can see the whole feature on the map.
You can place your label with the quadrants here and define offset and rotation.
The
Around centroid setting makes it possible to place the label
around the centroid with a certain distance. Again, you can define
visible polygon
or
whole polygon for the centroid.
With the
Using perimeter settings you can define a position and
a distance for the label. For the position
Above line,
On line,
Below line and
Line orientation dependend position are possible.
The entries in the Rendering menu are the same as for line layers. You can also use Suppress labeling of features smaller than in the Feature options.
Figure Labels 3:
Using data-defined override for labeling
With the data-defined override functions the settings for the labeling
are overwritten by entries in the attribute table.
You can activate/deactivate the function with the right-mouse button.
Hover over the symbol and you see the information about the data-defined override,
including the current definition field.
We now describe an example how to use the data-defined override function for the
Move label function (see figure_labels_4 ).
Figure Labels 4:
Figure Labels 5:
Within the Fields menu the field attributes of the
selected dataset can be manipulated. The buttons
New Column and
Delete Column
can be used, when the dataset is
Editing mode.
編集ウィジェット
Figure Fields 1:
Within the Fields menu you also find an edit widget column. This column can be used to define values or a range of values that are allowed to be added to the specific attribute table column. If you click on the [edit widget] button, a dialog opens, where you can define different widgets. These widgets are:
With the Attribute editor layout you can now define builtin forms for data entry jobs (see figure_fields_2).
Choose ‘Drag and drop designer’ and an attribute column. Use the Icon to create
a category that then will be shown during the digitizing session (see figure_fields_3). Next step will be to
assign the relevant fields to the category with the
Icon. You can create
more categories and use the same fields again. When creating a new category QGIS
will insert a new tab for the category in the built in form.
Other options in the dialog are ‘Autogenerate’ and ‘Provide ui-file’. ‘Autogenerate’ just creates Editors for all fields and tabulates them. The ‘Provide ui-file’ option allows you to use complex dialogs made with the Qt-Designer. Using an UI-file allows a large freedom in creating a dialog. For detailed information see http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ .
QGIS ダイアログはオープンされるときに呼ばれるpython関数を利用できます. この関数はあなたのダイアログに拡張ロジックを追加します. 一例です (MyForms.pyモジュールの中):
def open(dialog,layer,feature):
geom = feature.geometry()
control = dialog.findChild(QWidged,"My line edit")
Reference in Python Init Function like so: MyForms.open
MyForms.py は PYTHONPATH 内のフォルダに置くか, .qgis2/python, または プロジェクトフォルダになければいけません
Figure Fields 2:
Figure Fields 3:
このメニューはベクタレイヤの一般的な設定で利用します. ここには多くのオプションが利用できます:
レイヤ情報
displayed as を使うとレイヤの表示名称を変更できます
ベクタレイヤの Layer source を指定します
空間参照システム
ベクタレイヤに指定されている投影方法を閲覧や変更したい場合は 指定 ... をクリックして下さい
地物サブセット
Figure General 1:
In QGIS 2.0 there is now an own menu for the map tips. It includes a new feature:
Map Tip display text in HTML. While you can still choose a
Field
to be displayed when hovering over a feature on the map it is now possible to insert HTML code that creates a complex
display when hovering over a feature. To activate Map Tips, select the menu option View ‣ MapTips.Figure Display 1 shows an example of HTML code.
Figure Display 1:
Figure Display 2:
QGIS provides the ability to perform an action based on the attributes
of a feature. This can be used to perform any number of actions, for example,
running a program with arguments built from the attributes of a feature or
passing parameters to a web reporting tool.
Figure Actions 1:
Actions are useful when you frequently want to run an external application or view a web page based on one or more values in your vector layer. They are devided into 6 types and can be used like this:
There are several examples included in the dialog. You can load them clicking on [Add default actions]. An example is performing a search based on an attribute value. This concept is used in the following discussion.
アクションの定義
Attribute actions are defined from the vector Layer Properties dialog. To define an action, open the vector Layer Properties dialog and click on the Actions menu. Go to the Action properties. Select ‘Generic’ as type and provide a descriptive name for the action. The action itself must contain the name of the application that will be executed when the action is invoked. You can add one or more attribute field values as arguments to the application. When the action is invoked any set of characters that start with a % followed by the name of a field will be replaced by the value of that field. The special characters %% will be replaced by the value of the field that was selected from the identify results or attribute table (see using_actions below). Double quote marks can be used to group text into a single argument to the program, script or command. Double quotes will be ignored if preceded by a backslash.
If you have field names that are substrings of other field names (e.g., col1 and col10) you should indicate so, by surrounding the field name (and the % character) with square brackets (e.g., [%col10]). This will prevent the %col10 field name being mistaken for the %col1 field name with a 0 on the end. The brackets will be removed by QGIS when it substitutes in the value of the field. If you want the substituted field to be surrounded by square brackets, use a second set like this: [[%col10]].
Using the Identify Features tool you can open Identify Results dialog. It includes a (Derived) item that contains information relevant to the layer type. The values in this item can be accessed in a similar way to the other fields by using preceeding the derived field name by (Derived).. For example, a point layer has an X and Y field and the value of these can be used in the action with %(Derived).X and %(Derived).Y. The derived attributes are only available from the Identify Results dialog box, not the Attribute Table dialog box.
Two example actions are shown below:
In the first example, the web browser konqueror is invoked and passed a URL to open. The URL performs a Google search on the value of the nam field from our vector layer. Note that the application or script called by the action must be in the path or you must provide the full path. To be sure, we could rewrite the first example as: /opt/kde3/bin/konqueror http://www.google.com/search?q=%nam. This will ensure that the konqueror application will be executed when the action is invoked.
The second example uses the %% notation which does not rely on a particular field for its value. When the action is invoked, the %% will be replaced by the value of the selected field in the identify results or attribute table.
アクションの利用
Actions can be invoked from either the Identify Results dialog,
an Attribute Table dialog or from Run Feature Action
(recall that these dialogs can be opened by clicking
Identify Features or
Open Attribute Table or
Run Feature Action). To invoke an action, right
click on the record and choose the action from the popup menu. Actions are
listed in the popup menu by the name you assigned when defining the actions.
Click on the action you wish to invoke.
If you are invoking an action that uses the %% notation, right-click on the field value in the Identify Results dialog or the Attribute Table dialog that you wish to pass to the application or script.
Here is another example that pulls data out of a vector layer and inserts
them into a file using bash and the echo command (so it will only work
or perhaps
). The layer in question has fields for a species name
taxon_name, latitude lat and longitude long. I would like to be
able to make a spatial selection of a localities and export these field values
to a text file for the selected record (shown in yellow in the QGIS map area).
Here is the action to achieve this:
bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"
After selecting a few localities and running the action on each one, opening the output file will show something like this:
Acacia mearnsii -34.0800000000 150.0800000000
Acacia mearnsii -34.9000000000 150.1200000000
Acacia mearnsii -35.2200000000 149.9300000000
Acacia mearnsii -32.2700000000 150.4100000000
As an exercise we create an action that does a Google search on the lakes layer. First we need to determine the URL needed to perform a search on a keyword. This is easily done by just going to Google and doing a simple search, then grabbing the URL from the address bar in your browser. From this little effort we see that the format is: http://google.com/search?q=qgis, where QGIS is the search term. Armed with this information, we can proceed:
必ず``lakes``レイヤをロードしましょう。
Open the Layer Properties dialog by double-clicking on the layer in the legend or right-click and choose Properties from the popup menu.
Click on the Actions menu.
アクションの名前を入力して下さい.たとえば Google Search.
アクションを定義するために実行する外部プログラムの名前を提供しなければいけません. この場合私達はFirefoxを使います. もしプログラムがあなたのシステムのパス内に存在しない場合はフルパスを指定する必要があります.
以下の外部アプリケーション名にGoogle searchを行うためのURL http://google.com/search?q= を加えます.しかし検索文字は含まれていません
The text in the Action field should now look like this: firefox http://google.com/search?q=
lakes レイヤのフィールド名が含まれているドロップダウンボックスをクリックして下さい. それは [Insert Field] ボタンの左側にあります.
ドロップダウンボックスで ‘NAMES’ を選択した後に [Insert Field] をクリックして下さい.
あなたのアクションテキストは現在このようになっています:
firefox http://google.com/search?q=%NAMES
最後に [Add to action list] ボタンをクリックして下さい.
アクションは完成して利用可能になりました. 最終的なテキストはこのようになっています:
firefox http://google.com/search?q=%NAMES
これでアクションの利用が可能です. Layer Properties ダイアログを閉じて地図を見たい領域にズームして下さい. . lakes レイヤがアクティブであることに注意して地物情報表示ツールで湖をクリックして下さい. 結果表示ボックスの中にアクションが表示されているはずです:
Figure Actions 2:
When we click on the action, it brings up Firefox and navigates to the URL http://www.google.com/search?q=Tustumena. It is also possible to add further attribute fields to the action. Therefore you can add a + to the end of the action text, select another field and click on [Insert Field]. In this example there is just no other field available that would make sense to search for.
You can define multiple actions for a layer and each will show up in the Identify Results dialog.
You can think of all kinds of uses for actions. For example, if you have a point layer containing locations of images or photos along with a file name, you could create an action to launch a viewer to display the image. You could also use actions to launch web-based reports for an attribute field or combination of fields, specifying them in the same way we did in our Google search example.
We can also make more complex examples, for instance on how to use Python actions.
Usually when we create an action to open a file with an external application we can use absolute paths, or eventually relative paths, in the second case the path is relative to the location of the external program executable file. But what about we need to use relative paths, relative to the selected layer (a file based one, like a shapefile or spatialite)? The following code will do the trick:
command = "firefox";
imagerelpath = "images_test/test_image.jpg";
layer = qgis.utils.iface.activeLayer();
import os.path;
layerpath = layer.source() if layer.providerType() == 'ogr' \
else (qgis.core.QgsDataSourceURI(layer.source()).database() \
if layer.providerType() == 'spatialite' else None);
path = os.path.dirname(str(layerpath));
image = os.path.join(path,imagerelpath);
import subprocess;
subprocess.Popen( [command, image ] );
we have to just remember that the action is one of type Python and to change the command and imagerelpath variables to fit our needs.
But what about if the relative path need to be relative to the (saved) project file? The code of the Python action would be:
command="firefox";
imagerelpath="images/test_image.jpg";
projectpath=qgis.core.QgsProject.instance().fileName();
import os.path; path=os.path.dirname(str(projectpath)) if projectpath != '' else None;
image=os.path.join(path, imagerelpath);
import subprocess;
subprocess.Popen( [command, image ] );
Another Python actions example if the one that allows us to add new layers to the project. For instance the following examples will add to the project respectively a vector and a raster. The name of files to be added to the project and the name to be given to the layer are data driven (filename and layname are column names of the table of attributes of the vector where the action was created):
qgis.utils.iface.addVectorLayer('/yourpath/[% "filename" %].shp','[% "layername" %]',\
'ogr')
To add a raster (a tif image in this example) it becomes:
qgis.utils.iface.addRasterLayer('/yourpath/[% "filename" %].tif','[% "layername" %]')
The Joins menu allows you to join a loaded attribute table
to a loaded vector layer. After clicking
the Add vector join dialog appears.
As key columns you have to define a join layer you want to connect with the target vector layer , a join field that corresponds to an attribute column in the target layer and a target field you find in the attribute table of the target vector layer here. As a result, all information of the join layer and the target layer are displayed in the attribute table of the target layer as joined information.
QGIS では現在空間情報を持たない形式のテーブルの結合をサポートしています.そこには OGRでサポートされている (例 CSV, DBF と Excel)テーブル, デリミテッドテキストとPostgreSQL プロバイダ ( figure_joins_1 参照)が含まれます.
Figure Joins 1:
さらにベクタ結合ダイアログでは次のことができます:
ダイアグラム メニューではベクタレイヤにグラフィックオーバーレイを行うことができます ( figure_diagrams_1 参照).
現状のダイアグラムのコア実装はパイチャート、テキストダイアグラムとヒストグラムが提供されています.
The menu is divided into four tabs now: Appearance, Size, Postion and Options.
In the case of the text diagram and piechart text values of different data columns are displayed one below the other with a circle or a box and dividers. In the Size tab diagram size is based on a fixed size or on linear scaling according to a classification attribute. The placement of the diagrams which is done in the Position tab interacts with the new labeling, so position conflicts between diagrams and labels are detected and solved. In addition to chart positions can be fixed by the users hand.
Figure Diagrams 1:
We will demonstrate an example and overlay the alaska boundary layer a text diagram showing some temperature data from a climate vector layer. Both vector layers are part of the QGIS sample dataset (see Section サンプルデータ).
最後に [Ok] をクリックして下さい.
Figure Diagrams 2:
Remember that in the Position tab a Data defined position
of the diagrams is possible. Here you can use attributes to define the position of the diagram.
Also, a scale dependent visibility that you can find in the Appearance tab is possible.
The Metadata menu consists of a Description,
Attribution, MetadataURL and Properties section.
In the Properties section you get general information about the layer, including specifics about the type and location, number of features, feature type, and the editing capabilities in the Properties section. The Extents table provides you with layer extent information, and the Layer Spatial Reference System information, providing information about the CRS of the layer. This is a quick way to get information about the layer.
Additionally you can add/edit a title for the layer and some abstract information in the Description. Also, it’s possible to define a Keyword list here. These keyword lists can be used in a metadata catalogue. If you want to use a title from an XML metadata file you have to fill in a link in the DataUrl field. Use Attribution to get Atrribute data from an XML metadata catalogue. In MetadataUrl you can define the general path to the XML metadata catalogue. These information will be saved in the QGIS project file for following sessions and will be used for QGIS server.
Figure Metadata 1: