14.1. ベクタプロパティダイアログ

ベクタレイヤの レイヤプロパティ ダイアログには、地図内のレイヤの地物の外観(シンボロジ、ラベル、ダイアグラム)やマウスとのインタラクション(アクション、地図のTips、フォームデザイン)を管理するための一般的な設定があります。また、レイヤについての情報を提供します。

レイヤプロパティ ダイアログにアクセスするには:

  • レイヤ パネル内において、レイヤをダブルクリックするか、レイヤを右クリックしてポップアップメニューから プロパティ... を選択する

  • レイヤを選択した状態で、 レイヤ ► レイヤのプロパティ... メニューを選ぶ

ベクタ レイヤプロパティ ダイアログには以下のセクションがあります:

metadata 情報

system ソース

symbology シンボロジ[1]

labeling ラベル[1]

labelmask Mask[1]

3d 3Dビュー[1]

diagram ダイアグラム

sourceFields フィールド

formView 属性フォーム

join テーブル結合

auxiliaryStorage 補助テーブル

action アクション

display 表示名

rendering レンダリング

temporal Temporal

expression 変数

editMetadata メタデータ

dependencies 依存関係

legend 凡例

overlay QGISサーバー

digitizing デジタイズ

外部プラグイン[2] タブ

[1] レイヤスタイルパネル からも利用可能です

[2] インストールした 外部プラグイン は、任意でこのダイアログにタブを追加できます。これらについては、このドキュメントでは説明しません。外部プラグインのドキュメントを参照してください。

ちなみに

レイヤスタイルの完全なまたは部分的なプロパティを共有する

ダイアログの下部にある スタイル メニューを使用すると、レイヤスタイルのプロパティまたはその一部をさまざまな対象(ファイル、クリップボード、データベース)からインポートしたり、対象へエクスポートしたりすることができます。 カスタムスタイルを管理する を参照してください。

注釈

埋め込まれたレイヤ( プロジェクトを入れ子にする を参照)のプロパティ(シンボロジ、ラベル、アクション、デフォルト値、フォーム...)は、元のプロジェクトファイルから引き出されているため、この動作を壊す可能性のある変更を避けるために、埋め込まれたレイヤに対してはレイヤプロパティダイアログは利用できなくなっています。

14.1.1. 情報プロパティ

metadata 情報 タブは読み取り専用で、現在のレイヤの要約された情報やメタデータをさっと掴むことができる興味深い場所です。提供される情報には、以下のものがあります:

  • レイヤのプロバイダからの情報(ストレージ形式、パス、ジオメトリのタイプ、データソースのエンコーディング、領域など...)

  • メタデータ から抜き出した情報(アクセス、リンク、連絡先、履歴など...)

  • ジオメトリに関連した情報(空間領域、CRSなど...)や、属性(フィールドの数、各フィールドの特性など...)に関する情報

14.1.2. ソースプロパティ

system このタブでは、ベクタレイヤの一般的な設定の定義ができます。

../../../_images/vector_source_menu.png

図 14.1 ベクタレイヤプロパティダイアログのソースタブ

レイヤパネル 内に表示される レイヤ名 の設定の他に、以下のオプションがあります:

14.1.2.1. 座標参照系

  • レイヤの 座標参照系(CRS) を表示します。最近使用したCRSをドロップダウンリストから選ぶか、clicking on setProjection CRSの選択 ボタン( 座標参照系の選択 を参照)をクリックすることで、レイヤのCRSを変更できます。レイヤに適用されたCRSが間違っていた場合か、CRSが何も適用されていない場合にのみ、この操作を行ってください。データを別のCRSに再投影したい場合には、プロセシングアルゴリズムのレイヤの再投影を使用するか、 別のレイヤに保存 してください。

  • 空間インデックスの作成 (OGRがサポートする形式のみです)

  • 領域の更新 レイヤの領域情報を更新します。

14.1.2.2. クエリビルダ

クエリビルダ ダイアログは、レイヤプロパティダイアログの ソース タブの下部、 プロバイダ地物フィルタ グループの下にある名前どおりのボタンからアクセスできます。

クエリビルダは、SQLライクな WHERE句を使用してレイヤ内の地物のサブセットを定義し、メインウィンドウにその結果を表示するためのインターフェースを提供します。クエリが有効である限り、プロジェクトで利用可能となる地物はクエリの結果に対応するもののみです。

You can use one or more layer attributes to define the filter in the Query Builder. The use of more than one attribute is shown in 図 14.2. In the example, the filter combines the attributes

  • toa (DateTime フィールド: cast("toa" as character) > '2017-05-17'cast("toa" as character) < '2019-12-24T18:00:00') 、

  • name (String フィールド: "name" > 'S') 、

  • FID (Integer フィールド: FID > 10)

これらをAND、ORそしてNOT演算子と括弧で結合しています。この文法( toa フィールドのDateTime形式も含め)は、GeoPackageデータセットで動作します。

フィルタはデータプロバイダ(OGR、PostgreSQL、MSSQLなど...)のレベルで適用されます。従って、構文はデータプロバイダに依存します(例えばDateTime型はESRIシェープファイル形式ではサポートしていません)。完全な式は以下のようになります:

cast("toa" as character) > '2017-05-17' AND
cast("toa" as character) < '2019-12-24T18:00:00' AND
NOT ("name" > 'S' OR FID > 10)
../../../_images/queryBuilder.png

図 14.2 クエリビルダ

また、 クエリビルダ ダイアログは レイヤ メニューまたはレイヤのコンテキストメニューの フィルタ... オプションを使用して開くこともできます。ダイアログの フィールド演算子 セクションは、 プロバイダ特有のフィルタ式 ボックスに表示されるSQLライクなクエリを構築するのに役立ちます。

フィールド のリストには、レイヤの全てのフィールドが含まれます。SQL WHERE句フィールドに属性カラムを追加するには、フィールド名をダブルクリックするか、SQLボックスにフィールド名を入力します。

フレームは現在選択されているフィールドの値をリストします。フィールドのユニークな値を全てリストするには、 全て ボタンをクリックします。代わりに、カラムのユニークな値を最初の25個リストするには、 サンプル ボタンをクリックします。SQL WHERE句フィールドに値を追加するには、値リストの値をダブルクリックします。値フレームの上部にある検索ボックスを使用して、リスト内から属性値を簡単にブラウズして見つけることができます。

演算子 セクションには、使用可能な演算子全てが含まれています。SQL WHERE句フィールドに演算子を追加するには、適切なボタンをクリックします。関係演算子( => など...)、文字列比較演算子( LIKE )、論理演算子( ANDOR など...)が利用可能です。

テスト ボタンはクエリをチェックするのに役立ち、現在のクエリを満足する地物の数がメッセージボックスに表示されます。 クリア ボタンを使うと、SQLクエリを消去し、レイヤを元の状態(すなわち全ての地物を完全に読み込む状態)に戻します。

フィルタが適用されている場合、QGISは結果として得られるサブセットがレイヤの全体であるかのように扱います。例えば、 'Borough' にフィルタ("TYPE_2" = 'Borough' )を適用すると、 Anchorage を表示することも、クエリすることも、保存も編集もできません。なぜならば、これは 'Municipality' であり、従ってサブセットの部分には含まれないからです。

ちなみに

レイヤパネル内におけるフィルタされたレイヤの表示

レイヤ パネルにおいて、フィルタされたレイヤはレイヤの横に indicatorFilter フィルター アイコンが表示され、ボタンの上にマウスを置くと、使用されているクエリが表示されます。アイコンをダブルクリックすると クエリビルダ ダイアログが開き、フィルタを編集できます。

14.1.3. シンボロジプロパティ

symbology The Symbology tab provides you with a comprehensive tool for rendering and symbolizing your vector data. You can use tools that are common to all vector data, as well as special symbolizing tools that were designed for the different kinds of vector data. However all types share the following dialog structure: in the upper part, you have a widget that helps you prepare the classification and the symbol to use for features and at the bottom the レイヤーレンダリング widget.

ちなみに

異なるレイヤー表現をすばやく切り替える

Using the Styles ► Add menu at the bottom of the Layer Properties dialog, you can save as many styles as needed. A style is the combination of all properties of a layer (such as symbology, labeling, diagram, fields form, actions...) as you want. Then, simply switch between styles from the context menu of the layer in Layers Panel to automatically get different representations of your data.

ちなみに

ベクターシンボロジーをエクスポート

Google *.kml, *.dxfとMapInfo *.tab ファイルにQGISからベクターシンボルをエクスポートするオプションがあります。ちょうどレイヤーの右マウスメニューを開き、 名前を付けて保存を... 上のクリック出力ファイルの名前とその形式を指定します。ダイアログで シンボルエクスポート メニューを使用して、シンボルを、 地物シンボル ► または シンボルレイヤーシンボル ► のいずれかとして保存します。シンボルレイヤーを使用している場合は、第二の設定を使用することをお勧めします。

14.1.3.1. 地物のレンダリング

The renderer is responsible for drawing a feature together with the correct symbol. Regardless layer geometry type, there are four common types of renderers: single symbol, categorized, graduated and rule-based. For point layers, there are a point displacement and a heatmap renderers available while polygon layers can also be rendered with the inverted polygons and 2.5 D renderers.

連続カラーレンダラーはありません。実際には段階レンダラーの特殊な場合でしかないからです。分類および段階レンダラは、シンボルとカラーランプを指定して作成できる - それらは適宜、シンボルの色を設定します。各データタイプ(ポイント、ライン、およびポリゴン)のために、ベクターシンボルレイヤータイプが利用可能です。選択したレンダラーによっては、ダイアログで異なる追加のセクションが提供されます。

注釈

レンダラーの種類を変更する場合は、ベクターレイヤーのスタイルを設定するときは、シンボルのために作られた設定は維持されます。この手順は、1つの変更のために働くことに注意してください。レンダラーの種類を変更繰り返すとシンボルの設定は失われます。

14.1.3.1.1. 単一シンボルレンダラー

The singleSymbol Single Symbol renderer is used to render all features of the layer using a single user-defined symbol. See シンボルセレクタ for further information about symbol representation.

../../../_images/singlesymbol_ng_line.png

図 14.3 単一シンボルラインプロパティ

14.1.3.1.2. シンボルレンダラーなし

それはすべての地物に同じレンダリングを適用するよう nullSymbol シンボルなし レンダラーは、単一のシンボルレンダラーの特殊なユースケースです。このレンダラーを使用して、何のシンボルは、地物のために描かれませんが、ラベル付け、図や他の非記号の部分は、まだ表示されます。

選択はまだキャンバスでレイヤーの上に作ることができ、選択した地物は、デフォルトのシンボルで描画されます。編集中の地物も表示されます。

これは、あなただけのラベルやダイアグラムを表示したいレイヤーのための便利なショートカットとして意図され、そしてこれを達成するために、完全に透明の塗りつぶし/境界でシンボルをレンダリングする必要性を回避しています。

14.1.3.1.3. 分類レンダラー

The categorizedSymbol Categorized renderer is used to render the features of a layer, using a user-defined symbol whose aspect reflects the discrete values of a field or an expression.

../../../_images/categorysymbol_ng_line.png

図 14.4 分類シンボル化オプション

To use categorized symbology for a layer:

  1. Select the Value of classification: it can be an existing field or an expression you can type in the box or build using the associated expression button. Using expressions for categorizing avoids the need to create an ad hoc field for symbology purposes (eg, if your classification criteria are derived from one or more attributes).

    The expression used to classify features can be of any type; eg, it can:

    • be a comparison. In this case, QGIS returns values 1 (True) and 0 (False). Some examples:

      myfield >= 100
      $id = @atlas_featureid
      myfield % 2 = 0
      within( $geometry, @atlas_geometry )
      
    • combine different fields:

      concat( field_1, ' ', field_2 )
      
    • be a calculation on fields:

      myfield % 2
      year( myfield )
      field_1 + field_2
      substr( field_1, -3 )
      
    • be used to transform linear values to discrete classes, e.g.:

      CASE WHEN x > 1000 THEN 'Big' ELSE 'Small' END
      
    • combine several discrete values into a single category, e.g.:

      CASE
      WHEN building IN ('residence', 'mobile home') THEN 'residential'
      WHEN building IN ('commercial', 'industrial') THEN 'Commercial and Industrial'
      END
      

    ちなみに

    地物を分類するための式にはどんな種類も使用できますが、いくつかの複雑な式については 規則に基づくレンダリング を使用する方が簡単かもしれません。

  2. Configure the Symbol, which will be used as base symbol for all the classes;

  3. Indicate the Color ramp, ie the range of colors from which the color applied to each symbol is selected.

    Besides the common options of the color ramp widget, you can apply a unchecked Random Color Ramp to the categories. You can click the Shuffle Random Colors entry to regenerate a new set of random colors if you are not satisfied.

  4. Then click on the Classify button to create classes from the distinct values of the provided field or expression.

  5. Apply the changes if the live update is not in use and each feature on the map canvas will be rendered with the symbol of its class.

    By default, QGIS appends an all other values class to the list. While empty at the beginning, this class is used as a default class for any feature not falling into the other classes (eg, when you create features with new values for the classification field / expression).

Further tweaks can be done to the default classification:

  • You can signPlus Add new categories, signMinus Remove selected categories or Delete All of them.

  • A class can be disabled by unchecking the checkbox to the left of the class name; the corresponding features are hidden on the map.

  • Drag-and-drop the rows to reorder the classes

  • To change the symbol, the value or the legend of a class, double click the item.

Right-clicking over selected item(s) shows a contextual menu to:

  • Copy Symbol and Paste Symbol, a convenient way to apply the item's representation to others

  • Change Color... of the selected symbol(s)

  • Change Opacity... of the selected symbol(s)

  • Change Output Unit... of the selected symbol(s)

  • Change Width... of the selected line symbol(s)

  • Change Size... of the selected point symbol(s)

  • Change Angle... of the selected point symbol(s)

  • Merge Categories: Groups multiple selected categories into a single one. This allows simpler styling of layers with a large number of categories, where it may be possible to group numerous distinct categories into a smaller and more manageable set of categories which apply to multiple values.

    ちなみに

    Since the symbol kept for the merged categories is the one of the topmost selected category in the list, you may want to move the category whose symbol you wish to reuse to the top before merging.

  • Unmerge Categories that were previously merged

The Advanced menu gives access to options to speed classification or fine-tune the symbols rendering:

  • Match to saved symbols: Using the symbols library, assigns to each category a symbol whose name represents the classification value of the category

  • Match to symbols from file...: Provided a file with symbols, assigns to each category a symbol whose name represents the classification value of the category

  • Symbol levels... to define the order of symbols rendering.

ちなみに

Edit categories directly from the Layers panel

When a layer symbology is based on a categorized, graduated or rule-based symbology mode, you can edit each of the categories from the Layers Panel. Right-click on a sub-item of the layer and you will:

  • toggleAllLayers Toggle items visibility

  • showAllLayers Show all items

  • hideAllLayers Hide all items

  • Modify the symbol color thanks to the color selector wheel

  • Edit symbol... from the symbol selector dialog

  • Copy symbol

  • Paste symbol

14.1.3.1.4. 段階レンダラー

The graduatedSymbol Graduated renderer is used to render all the features from a layer, using an user-defined symbol whose color or size reflects the assignment of a selected feature's attribute to a class.

分類レンダラーと同じように一般レンダラーでは回転とサイズ縮尺の値を特定の列に定義できます.

また、分類レンダラーと同じように、以下を選択できます:

  • The value (using the fields listbox or the expression Set value expression function)

  • (シンボル選択ダイアログを使用して)、シンボル

  • 凡例形式と精度

  • 色やサイズ:記号を変更するために使用する方法

  • 色(カラーランプのリストを使用して)カラー方式が選択された場合

  • サイズ(サイズのドメインおよびその単位を使用して)

その後、割り当てられたフィールドまたは式の値のインタラクティブなヒストグラムを示すヒストグラム]タブを使用できます。クラスブレークが移動またはヒストグラムウィジェットを使用して追加できます。

注釈

ベクターレイヤーに関する詳細な情報を取得するために統計概要パネルを使用できます。 統計パネル 参照。

[クラス]タブに戻って、クラスの数および(モード]リストを使用して)クラス内の地物を分類するためのモードも指定できます。使用可能なモードは以下のとおりです:

  • Equal Count (Quantile): each class will have the same number of elements (the idea of a boxplot).

  • Equal Interval: each class will have the same size (e.g. with the values from 1 to 16 and four classes, each class will have a size of four).

  • Logarithmic scale: suitable for data with a wide range of values. Narrow classes for low values and wide classes for large values (e.g. for decimal numbers with range [0..100] and two classes, the first class will be from 0 to 10 and the second class from 10 to 100).

  • Natural Breaks (Jenks): the variance within each class is minimized while the variance between classes is maximized.

  • Pretty Breaks: computes a sequence of about n+1 equally spaced nice values which cover the range of the values in x. The values are chosen so that they are 1, 2 or 5 times a power of 10. (based on pretty from the R statistical environment https://www.rdocumentation.org/packages/base/topics/pretty).

  • Standard Deviation: classes are built depending on the standard deviation of the values.

The listbox in the center part of the Symbology tab lists the classes together with their ranges, labels and symbols that will be rendered.

選択したモードを使用してクラスを作成する 分類 ボタンをクリックしてください。各クラスは、クラス名の左にあるチェックボックスをオフに無効にできます。

シンボル、値および/またはクラスのラベルを変更するには、変更したい項目をダブルクリック。

Right-clicking over selected item(s) shows a contextual menu to:

  • Copy Symbol and Paste Symbol, a convenient way to apply the item's representation to others

  • Change Color... of the selected symbol(s)

  • Change Opacity... of the selected symbol(s)

  • Change Output Unit... of the selected symbol(s)

  • Change Width... of the selected line symbol(s)

  • Change Size... of the selected point symbol(s)

  • Change Angle... of the selected point symbol(s)

The example in 図 14.5 shows the graduated rendering dialog for the major_rivers layer of the QGIS sample dataset.

../../../_images/graduatedsymbol_ng_line.png

図 14.5 段階シンボル化オプション

ちなみに

式を利用した主題図

分類と段階主題は、式の結果を使用して作成できます。ベクターレイヤーのプロパティダイアログでは、属性選択は expression 列の式の設定 機能で拡張されます。だから、分類属性は、複数のフィールドの複合、またはある種の式になりたい場合は、属性テーブルで新しい列に分類属性を記述する必要はありません。

14.1.3.1.5. 比例シンボルと多変量解析

Proportional Symbol and Multivariate Analysis are not rendering types available from the Symbology rendering drop-down list. However with the data-defined override options applied over any of the previous rendering options, QGIS allows you to display your point and line data with such representation.

比例シンボルを作成する

To apply a proportional rendering:

  1. First apply to the layer the single symbol renderer.

  2. Then set the symbol to apply to the features.

  3. Select the item at the upper level of the symbol tree, and use the dataDefined Data-defined override button next to the Size (for point layer) or Width (for line layer) option.

  4. Select a field or enter an expression, and for each feature, QGIS will apply the output value to the property and proportionally resize the symbol in the map canvas.

    If need be, use the Size assistant... option of the dataDefined menu to apply some transformation (exponential, flannery...) to the symbol size rescaling (see データによる定義のアシスタントインターフェースを使用する for more details).

You can choose to display the proportional symbols in the Layers panel and the print layout legend item: unfold the Advanced drop-down list at the bottom of the main dialog of the Symbology tab and select Data-defined size legend... to configure the legend items (see Data-defined size legend for details).

../../../_images/proportional_symbols.png

図 14.6 Scaling airports size based on elevation of the airport

多変量解析を作成する

多変量解析のレンダリングを使用すると2つの以上の変数間の関係を評価するのに役立ちます。例えば、1つをカラーランプで表してもう1つをサイズで表現することができます。

The simplest way to create multivariate analysis in QGIS is to:

  1. First apply a categorized or graduated rendering on a layer, using the same type of symbol for all the classes.

  2. Then, apply a proportional symbology on the classes:

    1. Click on the Change button above the classification frame: you get the シンボルセレクタ dialog.

    2. Rescale the size or width of the symbol layer using the dataDefined data defined override widget as seen above.

Like the proportional symbol, the scaled symbology can be added to the layer tree, on top of the categorized or graduated classes symbols using the data defined size legend feature. And both representation are also available in the print layout legend item.

../../../_images/multivariate_example.png

図 14.7 Multivariate example with scaled size legend

14.1.3.1.6. Rule-based Renderer

The ruleBasedSymbol Rule-based renderer is used to render all the features from a layer, using rule-based symbols whose aspect reflects the assignment of a selected feature's attribute to a class. The rules are based on SQL statements and can be nested. The dialog allows rule grouping by filter or scale, and you can decide if you want to enable symbol levels or use only the first-matched rule.

To create a rule:

  1. Activate an existing row by double-clicking it (by default, QGIS adds a symbol without a rule when the rendering mode is enabled) or click the projectProperties Edit rule or signPlus Add rule button.

  2. In the Edit Rule dialog that opens, you can define a label to help you identify each rule. This is the label that will be displayed in the Layers Panel and also in the print composer legend.

  3. Manually enter an expression in the text box next to the radioButtonOn Filter option or press the expression button next to it to open the expression string builder dialog.

  4. Use the provided functions and the layer attributes to build an expression to filter the features you'd like to retrieve. Press the Test button to check the result of the query.

  5. You can enter a longer label to complete the rule description.

  6. You can use the checkbox Scale Range option to set scales at which the rule should be applied.

  7. Finally, configure the symbol to use for these features.

  8. And press OK.

A new row summarizing the rule is added to the Layer Properties dialog. You can create as many rules as necessary following the steps above or copy pasting an existing rule. Drag-and-drop the rules on top of each other to nest them and refine the upper rule features in subclasses.

Selecting a rule, you can also organize its features in subclasses using the Refine selected rules drop-down menu. Automated rule refinement can be based on:

Refined classes appear like sub-items of the rule, in a tree hierarchy and like above, you can set symbology of each class.

In the Edit rule dialog, you can avoid writing all the rules and make use of the radioButtonOff Else option to catch all the features that do not match any of the other rules, at the same level. This can also be achieved by writing Else in the Rule column of the Layer Properties ► Symbology ► Rule-based dialog.

Right-clicking over selected item(s) shows a contextual menu to:

  • Copy and Paste, a convenient way to create new item(s) based on existing item(s)

  • Copy Symbol and Paste Symbol, a convenient way to apply the item's representation to others

  • Change Color... of the selected symbol(s)

  • Change Opacity... of the selected symbol(s)

  • Change Output Unit... of the selected symbol(s)

  • Change Width... of the selected line symbol(s)

  • Change Size... of the selected point symbol(s)

  • Change Angle... of the selected point symbol(s)

  • Refine Current Rule: open a submenu that allows to refine the current rule with scales, categories (categorized renderer) or Ranges (graduated renderer).

The created rules also appear in a tree hierarchy in the map legend. Double-click the rules in the map legend and the Symbology tab of the layer properties appears showing the rule that is the background for the symbol in the tree.

The example in 図 14.8 shows the rule-based rendering dialog for the rivers layer of the QGIS sample dataset.

../../../_images/rulesymbol_ng_line.png

図 14.8 規則に基づくシンボル化オプション

14.1.3.1.7. Point displacement Renderer

The pointDisplacementSymbol Point Displacement renderer works to visualize all features of a point layer, even if they have the same location. To do this, the renderer takes the points falling in a given Distance tolerance from each other and places them around their barycenter following different Placement methods:

  • Ring: places all the features on a circle whose radius depends on the number of features to display.

  • Concentric rings: uses a set of concentric circles to show the features.

  • Grid: generates a regular grid with a point symbol at each intersection.

The Center symbol widget helps you customize the symbol and color of the middle point. For the distributed points symbols, you can apply any of the No symbols, Single symbol, Categorized, Graduated or Rule-based renderer using the Renderer drop-down list and customize them using the Renderer Settings... button.

While the minimal spacing of the Displacement lines depends on the point symbol renderer's, you can still customize some of its settings such as the Stroke width, Stroke color and Size adjustment (eg, to add more spacing between the rendered points).

Use the Labels group options to perform points labeling: the labels are placed near the displaced position of the symbol, and not at the feature real position. Other than the Label attribute, Label font and Label color, you can set the Minimum map scale to display the labels.

../../../_images/poi_displacement.png

図 14.9 ポイント変位ダイアログ

注釈

Point Displacement renderer does not alter feature geometry, meaning that points are not moved from their position. They are still located at their initial place. Changes are only visual, for rendering purpose. Use instead the Processing Points displacement algorithm if you want to create displaced features.

14.1.3.1.8. Point Cluster Renderer

Unlike the pointDisplacementSymbol Point Displacement renderer which blows up nearest or overlaid point features placement, the pointClusterSymbol Point Cluster renderer groups nearby points into a single rendered marker symbol. Based on a specified Distance, points that fall within from each others are merged into a single symbol. Points aggregation is made based on the closest group being formed, rather than just assigning them the first group within the search distance.

From the main dialog, you can:

  • set the symbol to represent the point cluster in the Cluster symbol; the default rendering displays the number of aggregated features thanks to the @cluster_size variable on Font marker symbol layer.

  • use the Renderer drop-down list to apply any of the other feature rendering types to the layer (single, categorized, rule-based...). Then, push the Renderer Settings... button to configure features' symbology as usual. Note that this renderer is only visible on features that are not clustered. Also, when the symbol color is the same for all the point features inside a cluster, that color sets the @cluster_color variable of the cluster.

../../../_images/cluster_symbol.png

図 14.10 Point Cluster dialog

注釈

Point Cluster renderer does not alter feature geometry, meaning that points are not moved from their position. They are still located at their initial place. Changes are only visual, for rendering purpose. Use instead the Processing K-means clustering or DBSCAN clustering algorithm if you want to create cluster-based features.

14.1.3.1.9. Inverted Polygon Renderer

invertedSymbol 逆ポリゴン レンダラーは、ユーザーがレイヤーのポリゴンの外側に塗りつぶしするシンボルを定義することを可能にします。上記のように、サブレンダラー、すなわち単一シンボル、段階、分類、規則に基づく、または2.5 Dのレンダラー、を選択できます。

../../../_images/inverted_polygon_symbol.png

図 14.11 反転ポリゴンダイアログ

14.1.3.1.10. Heatmap Renderer

With the heatmapSymbol Heatmap renderer you can create live dynamic heatmaps for (multi)point layers. You can specify the heatmap radius in millimeters, points, pixels, map units or inches, choose and edit a color ramp for the heatmap style and use a slider for selecting a trade-off between render speed and quality. You can also define a maximum value limit and give a weight to points using a field or an expression. When adding or removing a feature the heatmap renderer updates the heatmap style automatically.

../../../_images/heatmap_symbol.png

図 14.12 ヒートマップダイアログ

14.1.3.1.11. 2.5D Renderer

25dSymbol 2.5 D レンダラーを使用すると、レイヤーの地物上の 2.5 D の効果を作成することが可能です。 高さ 値(地図単位)選択して起動します。そのために、固定値で、レイヤーのフィールドのいずれか、または式を使用できます。(0° は西を意味し、反時計回り方向に大きく)、視聴者の位置を再作成するために 角度 (度)また、選択する必要があります。 屋根色壁色 設定するには、高度な設定オプションを使用します。地物の壁に太陽放射をシミュレートしたい場合は、 checkbox 方角に基づくシェードの壁 オプションをチェックしてください。また サイズ を設定することで、影をシミュレートできます(地図単位)。

../../../_images/2_5dsymbol.png

図 14.13 2.5Dダイアログ

ちなみに

他のレンダラーとともに2.5 D効果を使用する

2.5 Dレンダラーの基本的なスタイルの設定が完了したら、別のレンダラーにこれを変換できます(単一、分類、段階)。2.5 Dの効果は保持されますし、他のすべてのレンダラー固有のオプションを微調整それら(素敵な2.5次元表現を持つ例えば分類記号を持っているか、2.5 Dシンボルにいくつかの余分なスタイリングを追加できますこの方法)へのために利用できるようになります。( 詳細 ► シンボルレベル... )影と「建物」自体が他の近くの地物に干渉しないことを確認するために、シンボルレベルを有効にする必要があります。2.5 Dの高さと角度の値はレイヤーの変数に保存されているので、レイヤーのプロパティ]ダイアログボックスの[変数]タブで、後でそれを編集できます。

14.1.3.2. レイヤーレンダリング

From the Symbology tab, you can also set some options that invariably act on all features of the layer:

  • Opacity slider: You can make the underlying layer in the map canvas visible with this tool. Use the slider to adapt the visibility of your vector layer to your needs. You can also make a precise definition of the percentage of visibility in the menu beside the slider.

  • Blending mode at the Layer and Feature levels: You can achieve special rendering effects with these tools that you may previously only know from graphics programs. The pixels of your overlaying and underlaying layers are mixed through the settings described in 混合モード.

  • ペイント効果 を持つすべてのレイヤーの地物に 描画効果 ボタンを適用します。

  • 地物レンダリング順序を制御 では、地物属性を使用して、それらがレンダリングされなければならない Z-順序 を定義できます。チェックボックスを有効にし、をクリックしてください |browseButton| ボタンの横にあります。 順序を定義 ダイアログ次に、取得します:

    1. Choose a field or build an expression to apply to the layer features.

    2. Set in which order the fetched features should be sorted, i.e. if you choose Ascending order, the features with lower value are rendered under those with higher value.

    3. Define when features returning NULL value should be rendered: first (bottom) or last (top).

    4. Repeat the above steps as many times as rules you wish to use.

    The first rule is applied to all the features in the layer, z-ordering them according to their returned value. Then, within each group of features with the same value (including those with NULL value) and thus the same z-level, the next rule is applied to sort them. And so on...

../../../_images/layer_rendering_options.png

図 14.14 レイヤーのレンダリングオプション

14.1.3.3. 他の設定

14.1.3.3.1. Symbol levels

積み重ねのシンボルレイヤーを許可する(唯一のヒートマップだけはなし)レンダラーのために、各シンボルのレベルのレンダリング順序を制御するためのオプションがあります。

For most of the renderers, you can access the Symbols levels option by clicking the Advanced button below the saved symbols list and choosing Symbol levels. For the Rule-based Renderer the option is directly available through Symbols Levels... button, while for Point displacement Renderer renderer the same button is inside the Rendering settings dialog.

シンボルレベルを有効にするには checkbox シンボルレベルを有効にする を選択します。各行は、合成シンボル、ラベルとそれに次の番号の列に分割され、個々のシンボルレイヤーの少量のサンプルを表示されます。数字は、シンボルレイヤーが描画された描画順のレベルを表します。低い値のレベルが最初に描画され、底部に滞在、より高い値は他の上に最後に描かれます。

../../../_images/symbol_levels.png

図 14.15 シンボルレベルダイアログ

注釈

シンボルレベルを無効にしている場合は、完全なシンボルがそれぞれの地物順序に従って描画されます。重なるシンボルは、下の他のシンボルで単に見難くされます。また、同種のシンボルはお互いに「併合」されません。

../../../_images/symbol_levels_examples.png

図 14.16 シンボルレベルの有効(A)と無効(B)の差

14.1.3.3.2. Data-defined size legend

When a layer is rendered with the proportional symbol or the multivariate rendering or when a scaled size diagram is applied to the layer, you can allow the display of the scaled symbols in both the Layers panel and the print layout legend.

To enable the Data-defined Size Legend dialog to render symbology, select the eponym option in the Advanced button below the saved symbols list. For diagrams, the option is available under the Legend tab. The dialog provides the following options to:

  • select the type of legend: radioButtonOn Legend not enabled, radioButtonOff Separated legend items and radioButtonOff Collapsed legend. For the latter option, you can select whether the legend items are aligned at the Bottom or at the Center;

  • set the symbol to use for legend representation;

  • insert the title in the legend;

  • resize the classes to use: by default, QGIS provides you with a legend of five classes (based on natural pretty breaks) but you can apply your own classification using the checkbox Manual size classes option. Use the signPlus and signMinus buttons to set your custom classes values and labels.

A preview of the legend is displayed in the right panel of the dialog and updated as you set the parameters. For collapsed legend, a leader line from the horizontal center of the symbol to the corresponding legend text is drawn.

../../../_images/data_defined_size_legend.png

図 14.17 Setting size scaled legend

注釈

Currently, data-defined size legend for layer symbology can only be applied to point layer using single, categorized or graduated symbology.

14.1.3.3.3. 描画効果

地図の最終的なレンダリングのために他のソフトウェアに頼るのレイヤーのレンダリングを改善し、避ける(または少なくとも軽減)するために、QGISでは別の強力な機能を提供します: paintEffects 描画効果 オプション、これはベクターレイヤーの可視化をカスタマイズするための描画効果を追加します。

The option is available in the Layer Properties ► Symbology dialog, under the Layer rendering group (applying to the whole layer) or in symbol layer properties (applying to corresponding features). You can combine both usage.

Paint effects can be activated by checking the checkbox Draw effects option and clicking the paintEffects Customize effects button. That will open the Effect Properties Dialog (see 図 14.18). The following effect types, with custom options are available:

  • Source: Draws the feature's original style according to the configuration of the layer's properties. The Opacity of its style can be adjusted as well as the Blend mode and Draw mode. These are common properties for all types of effects.

    ../../../_images/source.png

    図 14.18 描画効果:[元]ダイアログ

  • Blur: Adds a blur effect on the vector layer. The custom options that you can change are the Blur type (Stack blur (fast) or Gaussian blur (quality)) and the Blur strength.

    ../../../_images/blur.png

    図 14.19 効果を描く:[ぼかし]ダイアログ

  • Colorise: This effect can be used to make a version of the style using one single hue. The base will always be a grayscale version of the symbol and you can:

    • Use the selectString Grayscale to select how to create it: options are 'By lightness', 'By luminosity', 'By average' and 'Off'.

    • If checkbox Colorise is selected, it will be possible to mix another color and choose how strong it should be.

    • Control the Brightness, Contrast and Saturation levels of the resulting symbol.

    ../../../_images/colorise.png

    図 14.20 描画効果:彩色ダイアログ

  • Drop Shadow: Using this effect adds a shadow on the feature, which looks like adding an extra dimension. This effect can be customized by changing the Offset angle and distance, determining where the shadow shifts towards to and the proximity to the source object. Drop Shadow also has the option to change the Blur radius and the Color of the effect.

    ../../../_images/drop_shadow.png

    図 14.21 描画効果:ドロップシャドウダイアログ

  • Inner Shadow: This effect is similar to the Drop Shadow effect, but it adds the shadow effect on the inside of the edges of the feature. The available options for customization are the same as the Drop Shadow effect.

    ../../../_images/inner_shadow.png

    図 14.22 描画効果:[内部シャドウ]ダイアログ

  • Inner Glow: Adds a glow effect inside the feature. This effect can be customized by adjusting the Spread (width) of the glow, or the Blur radius. The latter specifies the proximity from the edge of the feature where you want any blurring to happen. Additionally, there are options to customize the color of the glow using a Single color or a Color ramp.

    ../../../_images/inner_glow.png

    図 14.23 描画効果:インナーグローダイアログ

  • Outer Glow: This effect is similar to the Inner Glow effect, but it adds the glow effect on the outside of the edges of the feature. The available options for customization are the same as the Inner Glow effect.

    ../../../_images/outer_glow.png

    図 14.24 描画効果:光彩(外側)ダイアログ

  • Transform: Adds the possibility of transforming the shape of the symbol. The first options available for customization are the Reflect horizontal and Reflect vertical, which actually create a reflection on the horizontal and/or vertical axes. The other options are:

    • Shear X,Y: Slants the feature along the X and/or Y axis.

    • Scale X,Y: Enlarges or minimizes the feature along the X and/or Y axis by the given percentage.

    • Rotation: Turns the feature around its center point.

    • and Translate X,Y changes the position of the item based on a distance given on the X and/or Y axis.

    ../../../_images/transform.png

    図 14.25 描画効果:[変換]ダイアログ

One or more effect types can be used at the same time. You (de)activate an effect using its checkbox in the effects list. You can change the selected effect type by using the selectString Effect type option. You can reorder the effects using arrowUp Move up and arrowDown Move down buttons, and also add/remove effects using the signPlus Add new effect and signMinus Remove effect buttons.

There are some common options available for all draw effect types. Opacity and Blend mode options work similar to the ones described in レイヤーレンダリング and can be used in all draw effects except for the transform one.

There is also a selectString Draw mode option available for every effect, and you can choose whether to render and/or modify the symbol, following some rules:

  • Effects render from top to bottom.

  • Render only mode means that the effect will be visible.

  • Modifier only mode means that the effect will not be visible but the changes that it applies will be passed to the next effect (the one immediately below).

  • The Render and Modify mode will make the effect visible and pass any changes to the next effect. If the effect is at the top of the effects list or if the immediately above effect is not in modify mode, then it will use the original source symbol from the layers properties (similar to source).

14.1.4. ラベルプロパティ

The labeling Labels properties provides you with all the needed and appropriate capabilities to configure smart labeling on vector layers. This dialog can also be accessed from the Layer Styling panel, or using the labeling Layer Labeling Options button of the Labels toolbar.

The first step is to choose the labeling method from the drop-down list. Available methods are:

  • labelingNone No labels: the default value, showing no labels from the layer

  • labeling Single labels: Show labels on the map using a single attribute or an expression

  • labelingRuleBased Rule-based labeling

  • and labelingObstacle Blocking: allows to set a layer as just an obstacle for other layer's labels without rendering any labels of its own.

The next steps assume you select the labeling Single labels option, opening the following dialog.

../../../_images/label_menu_text.png

図 14.26 Layer labeling settings - Single labels

At the top of the dialog, a Value drop-down list is enabled. You can select an attribute column to use for labeling. By default, the display field is used. Click expression if you want to define labels based on expressions - See 式に基づいてラベルを定義する.

Below are displayed options to customize the labels, under various tabs:

Description of how to set each property is exposed at ラベルの設定.

14.1.4.1. Setting the automated placement engine

You can use the automated placement settings to configure a project-level automated behavior of the labels. In the top right corner of the Labels tab, click the autoPlacement Automated placement settings (applies to all layers) button, opening a dialog with the following options:

../../../_images/placement_engine.png

図 14.27 The labels automated placement engine

  • Number of candidates: calculates and assigns to line and polygon features the number of possible labels placement based on their size. The longer or wider a feature is, the more candidates it has, and its labels can be better placed with less risk of collision.

  • Text rendering: sets the default value for label rendering widgets when exporting a map canvas or a layout to PDF or SVG. If Always render labels as text is selected then labels can be edited in external applications (e.g. Inkscape) as normal text. BUT the side effect is that the rendering quality is decreased, and there are issues with rendering when certain text settings like buffers are in place. That's why Always render labels as paths (recommended) which exports labels as outlines, is recommended.

  • checkbox Allow truncated labels on edges of map: controls whether labels which fall partially outside of the map extent should be rendered. If checked, these labels will be shown (when there's no way to place them fully within the visible area). If unchecked then partially visible labels will be skipped. Note that this setting has no effects on labels' display in the layout map item.

  • unchecked Show all labels for all layers (i.e. including colliding objects). Note that this option can be also set per layer (see 描画(レンダリング))

  • unchecked Show unplaced labels: allows to determine whether any important labels are missing from the maps (e.g. due to overlaps or other constraints). They are displayed using a customizable color.

  • unchecked Show candidates (for debugging): controls whether boxes should be drawn on the map showing all the candidates generated for label placement. Like the label says, it's useful only for debugging and testing the effect different labeling settings have. This could be handy for a better manual placement with tools from the label toolbar.

  • Project labeling version: QGIS supports two different versions of label automatic placement:

    • Version 1: the old system (used by QGIS versions 3.10 and earlier, and when opening projects created in these versions in QGIS 3.12 or later). Version 1 treats label and obstacle priorities as "rough guides" only, and it's possible that a low-priority label will be placed over a high-priority obstacle in this version. Accordingly, it can be difficult to obtain the desired labeling results when using this version and it is thus recommended only for compatibility with older projects.

    • Version 2 (recommended): this is the default system in new projects created in QGIS 3.12 or later. In version 2, the logic dictating when labels are allowed to overlap obstacles has been reworked. The newer logic forbids any labels from overlapping any obstacles with a greater obstacle weight compared to the label's priority. As a result, this version results in much more predictable and easier to understand labeling results.

14.1.4.2. 規則に基づくラベル付け

規則に基づくラベル付けで、複数のラベルの設定を定義し、 規則に基づくレンダリング 同様に、表現フィルタと縮尺範囲のベースに選択的に適用できます.

To create a rule, select the labelingRuleBased Rule-based labeling option in the main drop-down list from the Labels tab and click the signPlus button at the bottom of the dialog. Then fill the new dialog with a description and an expression to filter features. You can also set a scale range in which the label rule should be applied. The other options available in this dialog are the common settings seen beforehand.

../../../_images/label_rule_settings.png

図 14.28 規則の設定

A summary of existing rules is shown in the main dialog (see 図 14.29). You can add multiple rules, reorder or imbricate them with a drag-and-drop. You can as well remove them with the signMinus button or edit them with projectProperties button or a double-click.

../../../_images/label_rules_panel.png

図 14.29 規則に基づくラベル作成パネル

14.1.4.3. 式に基づいてラベルを定義する

Whether you choose single or rule-based labeling type, QGIS allows using expressions to label features.

Assuming you are using the Single labels method, click the expression button near the Value drop-down list in the labeling Labels tab of the properties dialog.

In 図 14.30, you see a sample expression to label the alaska trees layer with tree type and area, based on the field 'VEGDESC', some descriptive text, and the function $area in combination with format_number() to make it look nicer.

../../../_images/label_expression.png

図 14.30 レベル付けに式を使用する

式に基づくラベル付けで作業するのは簡単です。世話をする必要があるすべては、次のとおりです。

  • You may need to combine all elements (strings, fields, and functions) with a string concatenation function such as concat, + or ||. Be aware that in some situations (when null or numeric value are involved) not all of these tools will fit your need.

  • 文字列は「一重引用符」で書かれます。

  • フィールドは、「二重引用符」または任意の引用符なしで書かれています。

いくつかの例を見てみましょう:

  1. カンマを区切り文字とする2つのフィールド「名前」と「場所」に基づくラベル:

    "name" || ', ' || "place"
    

    返します:

    John Smith, Paris
    
  2. 二つのフィールド「名前」や他のテキストと「場所」に基づくラベル:

    'My name is ' + "name" + 'and I live in ' + "place"
    'My name is ' || "name" || 'and I live in ' || "place"
    concat('My name is ', name, ' and I live in ', "place")
    

    返します:

    My name is John Smith and I live in Paris
    
  3. 二つのフィールド「名前」と「場所」に基づく他のテキストで異なる連結関数を組み合わせるラベル:

    concat('My name is ', name, ' and I live in ' || place)
    

    返します:

    My name is John Smith and I live in Paris
    

    フィールド「場所」のNULLである場合や、返し:

    My name is John Smith
    
  4. 二つのフィールド「名前」と「場所」に基づく説明テキストを持つマルチラインラベル:

    concat('My name is ', "name", '\n' , 'I live in ' , "place")
    

    返します:

    My name is John Smith
    I live in Paris
    
  5. フィールドに基づくラベルと$area関数は、場所の名前と丸められた領域のサイズを変換された単位で表示します。

    'The area of ' || "place" || ' has a size of '
    || round($area/10000) || ' ha'
    

    返します:

    The area of Paris has a size of 10500 ha
    
  6. CASE ELSE条件を作成します。 population フィールドの人口値が <= 50000 であれば、それは町です。さもなければ、それは市です:

    concat('This place is a ',
    CASE WHEN "population" <= 50000 THEN 'town' ELSE 'city' END)
    

    返します:

    This place is a town
    
  7. Display name for the cities and no label for the other features (for the "city" context, see example above):

    CASE WHEN "population" > 50000 THEN "NAME" END
    

    返します:

    Paris
    

式ビルダーで見ることができるように、QGISではデータにラベルを付けるために、シンプルで非常に複雑な式を作成するために利用可能な機能の数百を持っています。式の詳細と例については 章を参照。

14.1.4.4. ラベル付けのためにデータ定義の上書きを使用する

With the dataDefined Data defined override function, the settings for the labeling are overridden by entries in the attribute table or expressions based on them. This feature can be used to set values for most of the labeling options described above.

For example, using the Alaska QGIS sample dataset, let's label the airports layer with their name, based on their militarian USE, i.e. whether the airport is accessible to :

  • military people, then display it in gray color, size 8;

  • others, then show in blue color, size 10.

To do this, after you enabled the labeling on the NAME field of the layer (see ラベルの設定):

  1. Activate the Text tab.

  2. Click on the dataDefined icon next to the Size property.

  3. Select Edit... and type:

    CASE
      WHEN "USE" like '%Military%' THEN 8 -- because compatible values are 'Military'
                                          -- and 'Joint Military/Civilian'
      ELSE 10
    END
    
  4. Press OK to validate. The dialog closes and the dataDefined button becomes dataDefineExpressionOn meaning that an rule is being run.

  5. Then click the button next to the color property, type the expression below and validate:

    CASE
      WHEN "USE" like '%Military%' THEN '150, 150, 150'
      ELSE '0, 0, 255'
    END
    

Likewise, you can customize any other property of the label, the way you want. See more details on the dataDefined Data-define override widget's description and manipulation in データによって定義された上書きの設定 section.

../../../_images/label_attribute_data_defined.png

図 14.31 Airports labels are formatted based on their attributes

ちなみに

Use the data-defined override to label every part of multi-part features

There is an option to set the labeling for multi-part features independently from your label properties. Choose the render Rendering, Feature options, go to the dataDefined Data-define override button next to the checkbox unchecked Label every part of multipart-features and define the labels as described in データによって定義された上書きの設定.

14.1.4.4.1. ラベルツールバー

The Label Toolbar provides some tools to manipulate labeling label or diagram diagram properties.

../../../_images/diagram_toolbar.png

図 14.32 ラベルツールバー

読みやすくするために、 label は、ラベルのツールバーを記述するために以下で使用されてきたが、その名前に言及した際、ツールはダイアグラムとほぼ同じように動作していることに注意してください:

  • showPinnedLabels Highlight Pinned Labels and Diagrams. If the vector layer of the label is editable, then the highlighting is green, otherwise it's blue.

  • showUnplacedLabel Toggles Display of Unplaced Labels: Allows to determine whether any important labels are missing from the maps (e.g. due to overlaps or other constraints). They are displayed with a customizable color (see Setting the automated placement engine).

  • pinLabels Pin/Unpin Labels and Diagrams. By clicking or draging an area, you pin label(s). If you click or drag an area holding Shift, label(s) are unpinned. Finally, you can also click or drag an area holding Ctrl to toggle the pin status of label(s).

  • showHideLabels Show/Hide Labels and Diagrams. If you click on the labels, or click and drag an area holding Shift, they are hidden. When a label is hidden, you just have to click on the feature to restore its visibility. If you drag an area, all the labels in the area will be restored.

  • moveLabel Moves a Label or Diagram. You just have to drag the label to the desired place.

  • rotateLabel Rotates a Label. Click the label and move around and you get the text rotated.

  • changeLabelProperties Change Label Properties. It opens a dialog to change the clicked label properties; it can be the label itself, its coordinates, angle, font, size, multiline alignment ... as long as this property has been mapped to a field. Here you can set the option to checkbox Label every part of a feature.

警告

[ラベル]ツールは現在のフィールド値を上書きします

ラベルツールバー を使ってラベルをカスタマイズすると、マップされたフィールドにプロパティの新しい値が実際に書き込まれます。したがって、後で必要になるかもしれないデータを誤って置き換えないように注意してください!

注釈

The 補助テーブルプロパティ mechanism may be used to customize labeling (position, and so on) without modifying the underlying data source.

14.1.4.4.2. 地図キャンバスからラベルをカスタマイズする

Combined with the Label Toolbar, the data defined override setting helps you manipulate labels in the map canvas (move, edit, rotate). We now describe an example using the data-defined override function for the moveLabelMove label function (see 図 14.33).

  1. QGISサンプルデータセットから lakes.shp をインポートします。

  2. レイヤーのプロパティを開くには、レイヤーをダブルクリックします。 ラベル配置 をクリックしてください。 radioButtonOn 重心からのオフセット を選択してください。

  3. データによる定義 エントリを探します。 dataDefined アイコンをクリックして 座標 ためのフィールドタイプを定義します。Xには xlabel とYには ylabel を選択してください。アイコンが今黄色で強調表示されています。

    ../../../_images/label_coordinate_data_defined.png

    図 14.33 データ定義の上書きを有するベクターポリゴンレイヤーのラベリング

  4. 湖へズーム

  5. toggleEditing 編集切り替え ボタンを使用してレイヤーを編集可能に設定します。

  6. Go to the Label toolbar and click the moveLabel icon. Now you can shift the label manually to another position (see 図 14.34). The new position of the label is saved in the xlabel and ylabel columns of the attribute table.

  7. It's also possible to add a line connecting each lake to its moved label using:

注釈

The 補助テーブルプロパティ mechanism may be used with data-defined properties without having an editable data source.

14.1.5. ダイアグラムプロパティ

diagram The Diagrams tab allows you to add a graphic overlay to a vector layer (see 図 14.35).

図の現在のコアの実装は、以下にサポートを提供します:

  • diagramNone No diagrams: the default value with no diagram displayed over the features;

  • piechart Pie chart, a circular statistical graphic divided into slices to illustrate numerical proportion. The arc length of each slice is proportional to the quantity it represents;

  • text Text diagram, a horizontaly divided circle showing statistics values inside;

  • histogram Histogram, bars of varying colors for each attribute aligned next to each other

  • stackedBar Stacked bars, Stacks bars of varying colors for each attribute on top of each other vertically or horizontally

In the top right corner of the Diagrams tab, the autoPlacement Automated placement settings (applies to all layers) button provides means to control diagram labels placement on the map canvas.

ちなみに

図の種類をすばやく切り替える

設定は図の異なるタイプにほとんど共通していることを考えると、図を設計する際に、何も損失なしに簡単に図の種類を変更し、どれがデータにとってより適切であるか確認できます。

図の種類ごとに、プロパティはいくつかのタブに分けられます。

14.1.5.1. 属性

属性 ではどの変数をダイアグラムに表示するかを定義します。 signPlus 項目を追加 ボタンを使用して「割り当てられた属性」パネルに必要なフィールドを選択します。 で生成された属性も使用できます。

属性の表示方法を並べ替え、クリックとドラッグでアップし、任意の行下に移動できます。また、項目をダブルクリックすることで「凡例」列または属性色でラベルを変更できます。

This label is the default text displayed in the legend of the print layout or of the layer tree.

../../../_images/diagram_tab.png

図 14.35 Diagram properties - Attributes tab

14.1.5.2. レンダリング

Rendering defines how the diagram looks like. It provides general settings that do not interfere with the statistic values such as:

  • the graphic's opacity, its outline width and color;

  • depending on the type of diagram:

    • for histogram and stacked bars, the width of the bar and the spacing between the bars. You may want to set the spacing to 0 for stacked bars. Moreover, the Axis line symbol can be made visible on the map canvas and customized using line symbol properties.

    • for text diagram, the circle background color and the font used for texts;

    • for pie charts, the Start angle of the first slice and their Direction (clockwise or not).

  • the use of paint effects on the graphics.

In this tab, you can also manage and fine tune the diagram visibility with different options:

  • Diagram z-index: controls how diagrams are drawn on top of each other and on top of labels. A diagram with a high index is drawn over diagrams and labels;

  • checkbox Show all diagrams: shows all the diagrams even if they overlap each other;

  • Show diagram: allows only specific diagrams to be rendered;

  • Always Show: selects specific diagrams to always render, even when they overlap other diagrams or map labels;

  • setting the Scale dependent visibility;

../../../_images/diagram_tab_appearance.png

図 14.36 Diagram properties - Rendering tab

14.1.5.3. サイズ

Size is the main tab to set how the selected statistics are represented. The diagram size units can be 'Millimeters', 'Points', 'Pixels', 'Map Units' or 'Inches'. You can use:

  • Fixed size, a unique size to represent the graphic of all the features (not available for histograms)

  • or Scaled size, based on an expression using layer attributes:

    1. In Attribute, select a field or build an expression

    2. Press Find to return the Maximum value of the attribute or enter a custom value in the widget.

    3. For histogram and stacked bars, enter a Bar length value, used to represent the Maximum value of the attributes. For each feature, the bar lenght will then be scaled linearly to keep this matching.

    4. For pie chart and text diagram, enter a Size value, used to represent the Maximum value of the attributes. For each feature, the circle area or diameter will then be scaled linearly to keep this matching (from 0). A Minimum size can however be set for small diagrams.

../../../_images/diagram_tab_size.png

図 14.37 ダイアグラムのプロパティ - サイズタブ

14.1.5.4. 配置

Placement defines the diagram position. Depending on the layer geometry type, it offers different options for the placement (more details at Placement):

  • Around point or Over point for point geometry. The former variable requires a radius to follow.

  • Around line or Over line for line geometry. Like point feature, the first variable requires a distance to respect and you can specify the diagram placement relative to the feature ('above', 'on' and/or 'below' the line) It's possible to select several options at once. In that case, QGIS will look for the optimal position of the diagram. Remember that you can also use the line orientation for the position of the diagram.

  • Around centroid (at a set Distance), Over centroid, Using perimeter and Inside polygon are the options for polygon features.

The Coordinate group provides direct control on diagram placement, on a feature-by-feature basis, using their attributes or an expression to set the X and Y coordinate. The information can also be filled using the Move labels and diagrams tool.

In the Priority section, you can define the placement priority rank of each diagram, ie if there are different diagrams or labels candidates for the same location, the item with the higher priority will be displayed and the others could be left out.

Discourage diagrams and labels from covering features defines features to use as obstacles, ie QGIS will try to not place diagrams nor labels over these features. The priority rank is then used to evaluate whether a diagram could be omitted due to a greater weighted obstacle feature.

../../../_images/diagram_tab_placement.png

図 14.38 ダイアグラムプロパティを持つベクタープロパティダイアログ、配置タブ

14.1.5.5. オプション

The Options tab has settings for histograms and stacked bars. You can choose whether the Bar orientation should be Up, Down, Right or Left, for horizontal and vertical diagrams.

14.1.5.6. 凡例

From the Legend tab, you can choose to display items of the diagram in the Layers panel, and in the print layout legend, next to the layer symbology:

  • check Show legend entries for diagram attributes to display in the legends the Color and Legend properties, as previously assigned in the Attributes tab;

  • and, when a scaled size is being used for the diagrams, push the Legend Entries for Diagram Size... button to configure the diagram symbol aspect in the legends. This opens the Data-defined Size Legend dialog whose options are described in Data-defined size legend.

When set, the diagram legend items (attributes with color and diagram size) are also displayed in the print layout legend, next to the layer symbology.

14.1.6. Masks Properties

labelmask The Masks tab helps you configure the current layer symbols overlay with other symbol layers or labels, from any layer. This is meant to improve the readability of symbols and labels whose colors are close and can be hard to decipher when overlapping; it adds a custom and transparent mask around the items to "hide" parts of the symbol layers of the current layer.

To apply masks on the active layer, you first need to enable in the project either mask symbol layers or mask labels. Then, from the Masks tab, check:

  • the Masked symbol layers: lists in a tree structure all the symbol layers of the current layer. There you can select the symbol layer item you would like to transparently "cut out" when they overlap the selected mask sources

  • the Mask sources tab: list all the mask labels and mask symbol layers defined in the project. Select the items that would generate the mask over the selected masked symbol layers

../../../_images/masks_properties.png

図 14.39 Layer properties - Masks tab

14.1.7. 3Dビュープロパティ

3d The 3D View tab provides settings for vector layers that should be depicted in the 3D Map view tool.

For better performance, data from vector layers are loaded in the background, using multithreading, and rendered in tiles whose size can be controlled from the Layer rendering section of the tab:

  • Zoom levels count: determines how deep the quadtree will be. For example, one zoom level means there will be a single tile for the whole layer. Three zoom levels means there will be 16 tiles at the leaf level (every extra zoom level multiplies that by 4). The default is 3 and the maximum is 8.

  • checkbox Show bounding boxes of tiles: especially useful if there are issues with tiles not showing up when they should

To display a layer in 3D, select from the combobox at the top of the tab, either:

  • Single symbol: features are rendered using a common 3D symbol whose properties can be data-defined or not. Read details on setting a 3D symbol for each layer geometry type.

  • Rule-based: multiple symbol configurations can be defined and applied selectively based on expression filters and scale range. More details on how-to at Rule-based rendering.

../../../_images/3d_view_properties.png

図 14.40 3D properties of a point layer

14.1.8. フィールドプロパティ

sourceFields The Fields tab provides information on fields related to the layer and helps you organize them.

The layer can be made editable using the toggleEditing Toggle editing mode. At this moment, you can modify its structure using the newAttribute New field and deleteAttribute Delete field buttons.

You can also rename fields by double-clicking its name. This is only supported for data providers like PostgreSQL, Oracle, Memory layer and some OGR layer depending on the OGR data format and version.

If set in the underlying data source or in the forms properties, the field's alias is also displayed. An alias is a human readable field name you can use in the feature form or the attribute table. Aliases are saved in the project file.

Depending on the data provider, you can associate a comment with a field, for example at its creation. This information is retrieved and shown in the Comment column and is later displayed when hovering over the field label in a feature form.

Other than the fields contained in the dataset, virtual fields and Auxiliary Storage included, the Fields tab also lists fields from any joined layers. Depending on the origin of the field, a different background color is applied to it.

For each listed field, the dialog also lists read-only characteristics such as its type, type name, length and precision. When serving the layer as WMS or WFS, you can also check here which fields could be retrieved.

../../../_images/fields_properties.png

図 14.41 Fields properties tab

14.1.9. 属性フォームプロパティ

formView The Attributes Form tab helps you set up the form to display when creating new features or querying existing one. You can define:

  • the look and the behavior of each field in the feature form or the attribute table (label, widget, constraints...);

  • the form's structure (custom or autogenerated):

  • extra logic in Python to handle interaction with the form or field widgets.

At the top right of the dialog, you can set whether the form is opened by default when creating new features. This can be configured per layer or globally with the Suppress attribute form pop-up after feature creation option in the Settings ► Options ► Digitizing menu.

14.1.9.1. Customizing a form for your data

By default, when you click on a feature with the identify Identify Features tool or switch the attribute table to the form view mode, QGIS displays a basic form with predefined widgets (generally spinboxes and textboxes --- each field is represented on a dedicated row by its label next to the widget). If relations are set on the layer, fields from the referencing layers are shown in an embedded frame at the bottom of the form, following the same basic structure.

This rendering is the result of the default Autogenerate value of the Attribute editor layout setting in the Layer properties ► Attributes Form tab. This property holds three different values:

  • Autogenerate: keeps the basic structure of "one row - one field" for the form but allows to customize each corresponding widget.

  • Drag-and-drop designer: other than widget customization, the form structure can be made more complex eg, with widgets embedded in groups and tabs.

  • Provide ui file: allows to use a Qt designer file, hence a potentially more complex and fully featured template, as feature form.

14.1.9.1.1. The autogenerated form

When the Autogenerate option is on, the Available widgets panel shows lists of fields (from the layer and its relations) that would be shown in the form. Select a field and you can configure its appearance and behavior in the right panel:

14.1.9.1.2. ドラッグアンドドロップデザイナ

The drag and drop designer allows you to create a form with several containers (tabs or groups) to present the attribute fields, as shown for example in 図 14.42.

../../../_images/resulting_feature_form.png

図 14.42 内蔵の結果タブと名前付きグループを持つフォーム

  1. Choose Drag and drop designer from the Select attribute layout editor combobox. This enables the Form Layout panel next to the Available widgets panel, filled with existing fields. The selected field displays its properties in a third panel.

  2. Select fields you do not want to use in your Form Layout panel and hit the signMinus button to remove them. Drag and drop fields from the other panel to re-add them. The same field can be added multiple times.

  3. Drag and drop fields within the Form Layout panel to reorder their position.

  4. Add containers (tab or group frames) to associate fields that belong to the same category and better structure the form.

    1. The first step is to use the signPlus icon to create a tab in which fields and groups will be displayed

    2. Then set the properties of the container, ie:

      • the name

      • the type, ie a tab or a group in container (a group inside a tab or another group)

      • and the number of columns the embedded fields should be distributed over

      ../../../_images/attribute_editor_layout.png

      図 14.43 Dialog to create containers with the Attribute editor layout

      These, and other properties can later be updated by selecting the item and, from the third panel:

      • hide or show the container's label

      • display the container as a group box (only available for tabs).

      • rename the container

      • set the number of columns

      • enter an expression to control the container's visibility. The expression will be re-evaluated every time values in the form change, and the tab or group box shown/hidden accordingly

      • add a background color

    3. You can create as many containers as you want; press the signPlus icon again to create another tab or a group frame under an existing tab.

  5. The next step is to assign the relevant fields to each container, by simple drag and drop. Groups and tabs can also be moved in the same way.

  6. Customize the widget of the fields in use

  7. In case the layer is involved in a one or many to many relation, drag-and-drop the relation name from the Available widgets panel to the Form Layout panel. The associated layer attribute form will be embedded at the chosen place in the current layer's form. As for the other items, select the relation label to configure some properties:

    • hide or show the relation label

    • show the link button

    • show the unlink button

  8. Apply the layer's properties dialog

  9. Open a feature attribute form (eg, using the identify Identify features tool) and it should display the new form.

14.1.9.1.3. Using custom ui-file

UIファイルを提供 オプションでは、Qtデザイナで作られた複雑なダイアログを使用できます。UIファイルを使用すると、ダイアログボックスを作成するにはかなり自由にできます。レイヤーのフィールドにグラフィカルオブジェクト(テキストボックス、コンボボックス...)をリンクするためには同じ名前を与える必要がある、ということに注意してください。

UIを編集 を使って、使用するファイルへのパスを定義します。

UI-files can also be hosted on a remote server. In this case, you provide the URL of the form instead of the file path in Edit UI.

You'll find some example in the Creating a new form lesson of the QGISトレーニングマニュアル. For more advanced information, see https://woostuff.wordpress.com/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/.

14.1.9.1.4. カスタム関数でフォームを強化する

QGISフォームには、ダイアログを開いたときに呼び出されるPythonの関数を持たせることができます。ダイアログに追加のロジックを追加するには、この関数を使用してください。フォームのコードは3つの異なる方法で指定できます:

  • load from the environment: use a function, for example in startup.py or from an installed plugin

  • load from an external file: a file chooser will let you select a Python file from your filesystem or enter a URL for a remote file.

  • このダイアログでコードを提供する :Pythonエディタが表示され、そこで使用する関数を直接入力できます。

すべての場合において、呼び出される関数の名前を入力する必要があります(下の例では open )。

例は(MyForms.pyモジュール):

def open(dialog,layer,feature):
    geom = feature.geometry()
    control = dialog.findChild(QWidged,"My line edit")

そのようなPythonのinit関数で参照: open

14.1.9.2. フィールドの動作を設定する

The main part of the Attributes Form tab helps you set the type of widget used to fill or display values of the field, in the attribute table or the feature form: you can define how user interacts with each field and the values or range of values that are allowed to be added to each.

../../../_images/edit_widgets_dialog.png

図 14.44 属性列の編集ウィジェットを選択するためのダイアログ

14.1.9.2.1. 共通設定

Regardless the type of widget applied to the field, there are some common properties you can set to control whether and how a field can be edited.

14.1.9.2.1.1. Widget display

Show label: indicates whether the field name should be displayed in the form (only in the Drag and drop designer mode).

14.1.9.2.1.2. General options
  • Alias: a human readable name to use for fields. The alias will be displayed in the feature form, the attribute table, or in the Identify results panel. It can also be used as field name replacement in the expression builder, easing expressions understanding and reviews. Aliases are saved in project file.

  • Comment: displays the field's comment as shown in the Fields tab, in a read-only state. This information is shown as tooltip when hovering over the field label in a feature form.

  • checkbox Editable: uncheck this option to set the field read-only (not manually modifiable) even when the layer is in edit mode. Note that checking this setting doesn't override any edit limitation from the provider.

  • checkbox Label on top: places the field name above or beside the widget in the feature form.

14.1.9.2.1.3. デフォルト値
  • Default value: for new features, automatically populates by default the field with a predefined value or an expression-based one. For example, you can:

    • use $x, $length, $area to automatically populate a field with the feature's X coordinate, length, area or any geometric information at its creation;

    • increment a field by 1 for each new feature using maximum("field")+1;

    • save the feature creation datetime using now();

    • use variables in expressions, making it easier to e.g. insert the operator name (@user_full_name), the project file path (@project_path), ...

    A preview of the resulting default value is displayed at the bottom of the widget.

    注釈

    The Default value option is not aware of the values in any other field of the feature being created so it won't be possible to use an expression combining any of those values i.e using an expression like concat(field1, field2) may not work.

  • checkbox Apply default value on update: whenever the feature attribute or geometry is changed, the default value is recalculated. This could be handy to save values like last user that modifies data, last time it was changed...

14.1.9.2.1.4. Constraints

You can constrain the value to insert in the field. This constraint can be:

  • checkbox Not null: requires the user to provide a value;

  • checkbox Unique: guarantee the inserted value to be unique throughout the field;

  • based on a custom expression: e.g. not regexp_match(col0,'[^A-Za-z]') will ensure that the value of the field col0 has only alphabet letters. A short description can be added to help you remember the constraint.

Whenever a value is added or edited in a field, it's submitted to the existing constraints and:

  • if it meets all the requirements, a green check is shown beside the field in the form;

  • if it does not meet all the requirements, then a yellow or red cross is displayed near the field. You can hover over the cross to remind which constraints are applied to the field and fix the value:

    • A yellow cross appears when the unmet constraint is an unenforced one and it does not prevent you to save the changes with the "wrong" values;

    • A red cross can not be ignored and does not allow you to save your modifications until they meet the constraints. It appears when the checkbox Enforce constraint option is checked.

14.1.9.2.2. 編集ウィジェット

Based on the field type, QGIS automatically determines and assigns a default widget type to it. You can then replace the widget with any other compatible with the field type. The available widgets are:

  • Checkbox: Displays a checkbox whose state defines the value to insert.

  • Classification: Only available when a categorized symbology is applied to the layer, displays a combo box with the values of the classes.

  • Color: Displays a color widget allowing to select a color; the color value is stored as a html notation in the attribute table.

  • 日付/時刻 :日付、時刻、またはその両方を入力するには、カレンダーウィジェットを開くことができる行フィールドを表示します。列タイプはテキストでなければなりません。カスタム形式を選択でき、ポップアップカレンダーを、など

  • Enumeration: Opens a combo box with predefined values fetched from the database. This is currently only supported by the PostgreSQL provider, for fields of enum type.

  • Attachment: Uses a "Open file" dialog to store file path in a relative or absolute mode. It can also be used to display a hyperlink (to document path), a picture or a web page.

  • Hidden : 隠れた属性列は見ることができません. ユーザーはそのコンテンツをみることができません.

  • Key/Value: Displays a two-columns table to store sets of key/value pairs within a single field. This is currently supported by the PostgreSQL provider, for fields of hstore type.

  • List: Displays a single column table to add different values within a single field. This is currently supported by the PostgreSQL provider, for fields of array type.

  • レンジ :特定の範囲から数値を設定できます。編集ウィジェットは、スライダーまたはスピンボックスのいずれかになります。

  • Relation Reference: This is the default widget assigned to the referencing field (i.e., the foreign key in the child layer) when a relation is set. It provides direct access to the parent feature's form which in turn embeds the list and form of its children.

  • テキスト編集 (デフォルト):これは単純なテキストまたは複数行を使用できるテキスト編集フィールドを開きます。複数の行を選択した場合は、HTMLコンテンツを選択できます。

  • ユニークな値:すでに属性テーブルで使用される値のいずれかを選択できます。「編集可能」が有効になっている場合、ラインエディットは、そうでない場合は、コンボボックスが使用され、自動補完をサポートして示されています。

  • Uuid Generator: Generates a read-only UUID (Universally Unique Identifiers) field, if empty.

  • 値マップ:事前に定義された項目を持つコンボボックス。値は、属性に格納され、説明はコンボボックスに示されています。手動で値を定義するか、またはレイヤーまたはCSVファイルからそれらを読み込むことができます。

  • Value Relation: Offers values from a related table in a combobox. You can select layer, key column and value column. Several options are available to change the standard behaviors: allow null value, order by value, allow multiple selections and use of auto-completer. The forms will display either a drop-down list or a line edit field when completer checkbox is enabled.

ちなみに

Relative Path in Attachment widget

If the path which is selected with the file browser is located in the same directory as the .qgs project file or below, paths are converted to relative paths. This increases portability of a .qgs project with multimedia information attached.

14.1.10. テーブル結合プロパティ

join The Joins tab allows you to associate features of the current layer (called Target layer) to features from another loaded vector layer (or table). The join is based on an attribute that is shared by the layers. The layers can be geometryless (tables) or not but their join attribute should be of the same type.

To create a join:

  1. Click the signPlus Add new join button. The Add vector join dialog appears.

  2. Select the Join layer you want to connect with the target vector layer

  3. Specify the Join field and the Target field that are common to both the join layer and the target layer

  4. Press OK and a summary of selected parameters is added to the Join panel.

../../../_images/join_attributes.png

図 14.45 既存のベクターレイヤーに属性テーブルに参加

The steps above will create a join, where ALL the attributes of the first matching feature in the join layer is added to the target layer's feature. QGIS provides more options to tweak the join:

  • checkbox Cache join layer in virtual memory: allows you to cache values in memory (without geometries) from the joined layer in order to speed up lookups.

  • unchecked Create attribute index on the join field

  • unchecked Dynamic form: helps to synchronize join fields on the fly, according to the Target field. This way, constraints for join fields are also correctly updated. Note that it's deactivated by default because it may be very time consuming if you have a lot of features or a myriad of joins.

  • If the target layer is editable, then some icons will be displayed in the attribute table next to fields, in order to inform about their status:

    • joinNotEditable: the join layer is not configured to be editable. If you want to be able to edit join features from the target attribute table, then you have to check the option checkbox Editable join layer.

    • joinedLayerNotEditable: the join layer is well configured to be editable, but its current status is read only.

    • joinHasNotUpsertOnEdit: the join layer is editable, but synchronization mechanisms are not activated. If you want to automatically add a feature in the join layer when a feature is created in the target layer, then you have to check the option checkbox Upsert on edit. Symmetrically, the option checkbox Delete cascade may be activated if you want to automatically delete join features.

  • unchecked Joined fields: instead of adding all the fields from the joined layer, you can specify a subset.

  • unchecked Custom field name prefix for joined fields, in order to avoid name collision

QGIS currently has support for joining non-spatial table formats supported by OGR (e.g., CSV, DBF and Excel), delimited text and the PostgreSQL provider.

14.1.11. 補助テーブルプロパティ

The regular way to customize styling and labeling is to use data-defined properties as described in データによって定義された上書きの設定. However, it may not be possible if the underlying data is read only. Moreover, configuring these data-defined properties may be very time consuming or not desirable! For example, if you want to fully use map tools coming with ラベルツールバー, then you need to add and configure more than 20 fields in your original data source (X and Y positions, rotation angle, font style, color and so on).

The Auxiliary Storage mechanism provides the solution to these limitations and awkward configurations. Auxiliary fields are a roundabout way to automatically manage and store these data-defined properties (labels, diagram, symbology...) in a SQLite database thanks to editable joins. This allows you to store properties for layers that aren't editable.

A tab is available in vector layer properties dialog to manage auxiliary storage:

../../../_images/auxiliary_storage_tab.png

図 14.46 Auxiliary Storage tab

14.1.11.1. Labeling

Considering that the data source may be customized thanks to data-defined properties without being editable, labeling map tools described in ラベルツールバー are always available as soon as labeling is activated.

Actually, the auxiliary storage system needs an auxiliary layer to store these properties in a SQLite database (see Auxiliary storage database). Its creation process is run the first time you click on the map while a labeling map tool is currently activated. Then, a window is displayed, allowing you to select the primary key to use for joining (to ensure that features are uniquely identified):

../../../_images/auxiliary_storage_key.png

図 14.47 Auxiliary Layer creation dialog

As soon as an auxiliary layer is configured for the current data source, you can retrieve its information in the tab:

../../../_images/auxiliary_storage_tabkey.png

図 14.48 Auxiliary Layer key

The auxiliary layer now has these characteristics:

  • the primary key is ID,

  • there are 0 features using an auxiliary field,

  • there are 0 auxiliary fields.

Now that the auxiliary layer is created, you can edit the layer labels. Click on a label while the changeLabelProperties Change Label map tool is activated, then you can update styling properties like sizes, colors, and so on. The corresponding data-defined properties are created and can be retrieved:

../../../_images/auxiliary_storage_fields.png

図 14.49 Auxiliary Fields

As you can see in the figure above, 21 fields are automatically created and configured for labeling. For example, the FontStyle auxiliary field type is a String and is named labeling_fontstyle in the underlying SQLite database. There is also 1 feature which is currently using these auxiliary fields.

Notice that the icon dataDefineOn is displayed in the Labels properties tab indicating that the data-defined override options are set correctly:

../../../_images/auxiliary_storage_dd.png

図 14.50 Data-defined properties automatically created

Otherwise, there's another way to create an auxiliary field for a specific property thanks to the dataDefined data-defined override button. By clicking on Store data in the project, an auxiliary field is automatically created for the Opacity field. If you click on this button and the auxiliary layer is not created yet, a window (図 14.47) is first displayed to select the primary key to use for joining.

14.1.11.2. シンボロジー

Like the method described above for customizing labels, auxiliary fields can also be used to stylize symbols and diagrams. To do this, click on dataDefined Data-defined override and select Store data in the project for a specific property. For example, the Fill color field:

../../../_images/auxiliary_storage_symbol.png

図 14.51 Data-defined property menu for symbol

There are different attributes for each symbol (e.g. fill style, fill color, stroke color, etc...), so each auxiliary field representing an attribute requires a unique name to avoid conflicts. After selecting Store data in the project, a window opens and displays the Type of the field and prompts you to enter a unique name for the auxiliary field. For example, when creating a Fill color auxiliary field the following window opens:

../../../_images/auxiliary_storage_symbol_name.png

図 14.52 Name of the auxiliary field for a symbol

Once created, the auxiliary field can be retrieved in the auxiliary storage tab:

../../../_images/auxiliary_storage_symbol_field.png

図 14.53 Auxiliary field symbol

14.1.11.3. Attribute table and widgets

Auxiliary fields can be edited using the attribute table. However, not all auxiliary fields are initially visible in the attribute table.

Auxiliary fields representing attributes of a layer's symbology, labeling, appearance, or diagrams will appear automatically in the attribute table. The exception are attributes that can be modified using the Label Toolbar which are hidden by default. Auxiliary fields representing a Color have a widget Color set by default, otherwise auxiliary fields default to the Text Edit widget.

Auxiliary fields that represent attributes that can be modified using the Label toolbar are Hidden in the attribute table by default. To make a field visible, open the Attribute Form properties tab and change the value of an auxiliary field Widget Type from Hidden to another relevant value. For example, change the auxiliary_storage_labeling_size to Text Edit or change auxiliary_storage_labeling_color to the Color widget. Those fields will now be visible in the attribute table.

Auxiliary fields in the attribute table will appear like the following image:

../../../_images/auxiliary_storage_widgets.png

図 14.54 Form with auxiliary fields

14.1.11.4. Management

The Auxiliary Layer menu allows you to manage the auxiliary fields:

../../../_images/auxiliary_storage_actions.png

図 14.55 Auxiliary layer management

The first item Create is disabled in this case because the auxiliary layer is already created. But in case of a fresh work, you can use this action to create an auxiliary layer. As explained in Labeling, a primary key will be needed then.

The Clear action allows to keep all auxiliary fields, but remove their contents. This way, the number of features using these fields will fall to 0.

The Delete action completely removes the auxiliary layer. In other words, the corresponding table is deleted from the underlying SQLite database and properties customization are lost.

Finally, the Export action allows to save the auxiliary layer as a new vector layer. Note that geometries are not stored in auxiliary storage. However, in this case, geometries are exported from the original data source too.

14.1.11.5. Auxiliary storage database

When you save your project with the .qgs format, the SQLite database used for auxiliary storage is saved at the same place but with the extension .qgd.

For convenience, an archive may be used instead thanks to the .qgz format. In this case, .qgd and .qgs files are both embedded in the archive.

14.1.12. アクションプロパティ

action QGISには地物の属性に基づいてアクションを実行する機能があります。これは任意の数のアクションを実行するために使用できます。例えば、地物の属性から構築された引数でプログラムを実行するり、Webレポーティングツールにパラメーター渡す、など。

../../../_images/action_dialog.png

図 14.56 いくつかのサンプルアクションを含む概要アクションダイアログ

頻繁に外部のアプリケーションを実行したり、ベクターレイヤーに1つ以上の値に基づいてWebページを表示する際にアクションが便利です。それらは、6つのタイプに分けられ、このように使用できます。

  • Generic、Mac、WindowsとUnixのアクションが外部プロセスを開始します。

  • Python アクションは Python 構文を実行します.

  • GenericとPythonのアクションはどこでも見ることができます。

  • Mac、WindowsとUnixのアクションはそれぞれのプラットフォーム上だけに表示されます(つまり、エディタを開く「編集」アクションは3つ定義でき、ユーザーはそのエディタを実行するプラットフォームのための1つの「編集」アクションだけを表示して実行できます) 。

There are several examples included in the dialog. You can load them by clicking on Create Default Actions. To edit any of the examples, double-click its row. One example is performing a search based on an attribute value. This concept is used in the following discussion.

The checkbox Show in Attribute Table allows you to display in the attribute table dialog the checked feature-scoped actions, either as Combo Box or as Separate Buttons (see Configuring the columns).

14.1.12.1. アクションの定義

属性のアクションを定義するには、ベクター レイヤーのプロパティ ダイアログを開いて アクション タブをクリックしてください。 アクション タブ中で signPlus 新しいアクションを追加 をクリックして アクションを編集 ダイアログ開きます。

アクションの タイプ を選択し、アクションのわかりやすい名前を指定します。アクション自体は、アクションが呼び出されたときに実行されるアプリケーションの名前が含まれている必要があります。アプリケーションへの引数として1つ以上の属性フィールドの値を追加できます。アクションが呼び出されると、フィールドの名前に続いて % で始まる任意の文字の集合は、そのフィールドの値に置き換えられます。特殊文字 :index:%% (以下 using_actions 参照)を識別結果や属性テーブルから選択されたフィールドの値によって置き換えられます。二重引用符は、プログラム、スクリプトまたはコマンドへの単一の引数にグループのテキストに使用できます。前にバックスラッシュを付けた場合、二重引用符は無視されます。

The Action Scopes allows you to define where the action should be available. You have 4 different choices:

  1. Feature Scope: action is available when right click in the cell within the attribute table.

  2. Field Scope: action is available when right click in the cell within the attribute table, in the feature form and in the default action button of the main toolbar.

  3. Layer Scope: action is available in the action button in the attribute table toolbar. Be aware that this type of action involves the entire layer and not the single features.

  4. Canvas: action is available in the main action button in the toolbar.

他のフィールド名の部分文字列であるフィールド名を持っている場合(例えば、 col1col10 )、角括弧(および % 文字)でフィールド名を囲むことで示す必要があります(例えば、 [%col10] )。 こうすることで %col10 フィールド名が 末尾に 0 がある %col1 フィールド名と間違えることを防げます。フィールドの値に代入したとき括弧はQGISによって除去されます。置換されたフィールドを角括弧で囲みたい場合は、このような第2のセットを使用します: [[%col10]]

地物識別 ツールを使用して、 識別結果 ダイアログを開くことができます。これは、レイヤーのタイプに関連する情報が含まれる (派生) アイテムを含みます。この項目の値は、 (派生). で派生されるフィールド名を進めることにより、その他のフィールドと同様の方法でアクセスできます。例えば、点レイヤーは、 XY フィールドを有し、これらのフィールドの値は、 %(派生).X%(派生).Y でアクション中で使用できます。派生属性は 属性テーブル ダイアログボックスではなく、識別結果 ダイアログボックスからのみ利用可能です。

二つの例のアクションは以下の通りです:

  • konqueror https://www.google.com/search?q=%nam

  • konqueror https://www.google.com/search?q=%%

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 certain, we could rewrite the first example as: /opt/kde3/bin/konqueror https://www.google.com/search?q=%nam. This will ensure that the konqueror application will be executed when the action is invoked.

第二の例では %% 表記を使用しますが、その値は特定のフィールドに依存しません。アクションが呼び出されると、 %% は、識別結果や属性テーブルの選択したフィールドの値に置き換えられます。

14.1.12.2. アクションを使用する

QGIS offers many ways to execute actions you enabled on a layer. Depending on their settings, they can be available:

  • in the drop-down menu of actionRun Run Feature Action button from the Attributes toolbar or Attribute table dialog;

  • when right-clicking a feature with the identify Identify Features tool (see 地物を識別する for more information);

  • from the Identify Results panel, under the Actions section;

  • as items of an Actions column in the Attribute Table dialog.

もし %% 表記を使ってアクションを呼び出した場合, アプリケーションかスクリプトに渡したいフィールドを 識別結果 ダイアログか 属性テーブル ダイアログで右クリックして下さい.

nix または多分 osx だけで動作します)ここでは別のベクターレイヤーからデータを引き出し、bashを使用してファイルと echo コマンドに挿入する例があります。当該レイヤーは、種名 taxon_name 、緯度 lat 及び経度 long のためのフィールドを有しています。地域の空間的な選択を行うと(QGIS地図領域に黄色で表示)選択したレコードのためのテキストファイルにこれらのフィールドの値をエクスポートできるようにしたいと思います。ここでは、これを達成するためのアクションは次のとおりです。

bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"

いくつかの地域を選択して、それぞれのアクションを実行し、出力ファイルを開いた後、このようなものが表示されます。

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 can create an action that does a Google search on the lakes layer. First, we need to determine the URL required 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 https://www.google.com/search?q=QGIS, where QGIS is the search term. Armed with this information, we can proceed:

  1. 必ず lakes レイヤーをロードしましょう。

  2. 凡例中のレイヤーをダブルクリックして レイヤーのプロパティ ダイアログを開き、または右クリックしてポップアップメニューから プロパティ を選択します。

  3. アクション タブをクリックします。

  4. Click signPlus Add a new action.

  5. Choose the Open action type,

  6. アクションの名前を入力して下さい.たとえば Google Search.

  7. Additionally you can add a Short Name or even an Icon.

  8. Choose the action Scope. See アクションの定義 for further information. Leave the default settings for this example.

  9. アクションを定義するために実行する外部プログラムの名前を提供しなければいけません. この場合私達はFirefoxを使います. もしプログラムがシステムのパス内に存在しない場合はフルパスを指定する必要があります.

  10. Following the name of the external application, add the URL used for doing a Google search, up to but not including the search term: https://www.google.com/search?q=

  11. The text in the Action field should now look like this: https://www.google.com/search?q=

  12. Click on the drop-down box containing the field names for the lakes layer. It's located just to the left of the Insert button.

  13. From the drop-down box, select 'NAMES' and click Insert.

  14. アクションテキストは現在このようになっています:

    https://www.google.com/search?q=[%NAMES%]

  15. To finalize and add the action, click the OK button.

../../../_images/add_action_edit.png

図 14.57 この例で設定されたアクションの編集ダイアログ

アクションは完成して利用可能になりました. 最終的なテキストはこのようになっています:

https://www.google.com/search?q=[%NAMES%]

これでアクションの利用が可能です。 レイヤーのプロパティ ダイアログを閉じて地図を見たい領域にズームして下さい。 lakes レイヤーがアクティブであることに注意して地物情報表示ツールで湖をクリックして下さい。結果表示ボックスの中にアクションが表示されているはずです:

../../../_images/action_identifyaction.png

図 14.58 地物を選択し、アクションを選択してください

When we click on the action, it brings up Firefox and navigates to the URL https://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.

レイヤーのための複数のアクションを定義でき、それぞれに表示されます 結果 ダイアログを確認します。

また、ポップアップメニューからアクションを選択し、行および右クリックを選択することにより、属性テーブルからアクションを呼び出すことができます。

アクションのための用途のすべての種類があります。たとえば、ファイル名と一緒に画像や写真の場所を含むポイントレイヤーを持っている場合、画像を表示するビューアを起動するアクションを作成できます。また、アクションを使用して、属性フィールドまたはフィールドの組み合わせのためのWebベースのレポートを、Google検索の例で行ったのと同じ方法でそれらを指定することで、起動できるでしょう。

また、より複雑な例を、例えば Python アクションを使用して作成できます。

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 if we need to use relative paths, relative to the selected layer (a file-based one, like 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 ] )

アクションは Python の一種であり、 コマンドimagerelpath 変数は必要に合わせて変更する必要があることだけ覚えておく必要があります。

しかし、相対パスが(保存された)プロジェクトファイルに相対的である必要がある場合はどうですか?Pythonのアクションのコードは次のようになります。

command = "firefox"
imagerelpath = "images_test/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 ] )

別のPythonの動作例は、プロジェクトに新しいレイヤーを追加することが可能にするものです。例えば、以下の実施例は、それぞれプロジェクトベクターとラスターに追加します。プロジェクトに追加するファイルの名前やレイヤーに与えられる名前はデータ駆動型です( filenamelayername は、アクションが作成されたベクターの属性テーブルの列名です)

qgis.utils.iface.addVectorLayer('/yourpath/[% "filename" %].shp',
  '[% "layername" %]', 'ogr')

ラスター(この例ではTIF画像)を追加するには、次のようになります:

qgis.utils.iface.addRasterLayer('/yourpath/[% "filename" %].tif',
  '[% "layername" %]')

14.1.13. 表示名プロパティ

display The Display tab helps you configure fields to use for feature identification:

  • The Display name: based on a field or an expression. This is:

    • the label shown on top of the feature information in the Identify tool results

    • the field used in the locator bar when looking for features in all layers

    • the feature identifier in the attribute table form view

    • the feature identifier when the map or layout is exported to a layered output format such as GeoPDF

    • the map tip information, i.e. the message displayed in the map canvas when hovering over a feature of the active layer with the mapTips Show Map Tips icon pressed. Applicable when no HTML Map Tip is set.

  • The HTML Map Tip is specifically created for the map tips: it's a more complex and full HTML text mixing fields, expressions and html tags (multiline, fonts, images, hyperlink...).

../../../_images/display_html.png

図 14.59 地図ヒントのためのHTMLコード

To activate map tips, select the menu option View ► Show Map Tips or click on the mapTips Show Map Tips icon of the Attributes Toolbar. Map tip is a cross-session feature meaning that once activated, it stays on and apply to any layer in any project, even in future QGIS sessions until it's toggled off.

../../../_images/map_tip.png

図 14.60 HTMLコードで作られた地図ヒント

14.1.14. レンダリングプロパティ

14.1.14.1. 縮尺に応じた表示設定

最大(含む)最小(含まない) 縮尺を設定して、地物が表示される縮尺の範囲を定義できます。この範囲の外ではそれらは非表示になります。 mapIdentification 現在のキャンバス縮尺 ボタンに設定を使用すると、範囲の可視性の境界として、現在の地図キャンバスの縮尺を使用できます。詳細は 縮尺依存レンダリング 参照。

14.1.14.2. Simplify geometry

QGIS offers support for on-the-fly feature generalisation. This can improve rendering times when drawing many complex features at small scales. This feature can be enabled or disabled in the layer settings using the checkbox Simplify geometry option. There is also a global setting that enables generalisation by default for newly added layers (see global simplification for more information).

../../../_images/simplify_rendering.png

図 14.61 レイヤージオメトリ単純化ダイアログ

注釈

地物の総描は、いくつかの場合では、レンダリングされた出力にアーティファクトを持ち込むことがあります。これらは、ポリゴンとオフセットベースシンボルレイヤーを使用して不正確なレンダリングの間にスライバを含むことがあります。

While rendering extremely detailed layers (e.g. polygon layers with a huge number of nodes), this can cause layout exports in PDF/SVG format to be huge as all nodes are included in the exported file. This can also make the resultant file very slow to work with/open in other programs.

checkbox レイヤーをラスターとしてレンダリングするよう強制 をチェックすると、エクスポートされるファイルにこれらのレイヤーに含まれるすべてのノードが含まれる必要がなく、それゆえレンダリングが高速化されるように、これらのレイヤーがラスター化されることを強制します。

You can also do this by forcing the layout to export as a raster, but that is an all-or-nothing solution, given that the rasterisation is applied to all layers.

Refresh layer at interval (seconds): set a timer to automatically refresh individual layers at a matching interval. Canvas updates are deferred in order to avoid refreshing multiple times if more than one layer has an auto update interval set.

Depending on the data provider (e.g. PostgreSQL), notifications can be sent to QGIS when changes are applied to the data source, out of QGIS. Use the checkbox Refresh layer on notification option to trigger an update. You can also limit the layer refresh to a specific message set in the checkbox Only if message is text box.

14.1.15. 変数プロパティ

expression 変数 タブには、(すべてのグローバルおよびプロジェクトの変数を含む)レイヤーのレベルで利用可能なすべての変数を示しています。

また、ユーザーはレイヤーレベルの変数を管理できます。 signPlus をクリックします。ボタンを押して、新しいカスタムレイヤーレベル変数を追加します。同様に、リストからカスタムレイヤーレベル変数を選択し、 signMinus ボタンを押して削除します。

値を変数に格納する セクションに一般ツールでの変数の使用方法の詳細があります。

14.1.16. メタデータプロパティ

editMetadata The Metadata tab provides you with options to create and edit a metadata report on your layer. Information to fill concern:

  • the data Identification: basic attribution of the dataset (parent, identifier, title, abstract, language...);

  • the Categories the data belongs to. Alongside the ISO categories, you can add custom ones;

  • the Keywords to retrieve the data and associated concepts following a standard based vocabulary;

  • the Access to the dataset (licenses, rights, fees, and constraints);

  • the Extent of the dataset, either spatial one (CRS, map extent, altitudes) or temporal;

  • the Contact of the owner(s) of the dataset;

  • the Links to ancillary resources and related information;

  • the History of the dataset.

A summary of the filled information is provided in the Validation tab and helps you identify potential issues related to the form. You can then either fix them or ignore them.

Metadata are currently saved in the project file. They can also be saved in a .qmd file alongside file based layers or in a local .sqlite database for remote layers (e.g. PostGIS).

14.1.17. 依存関係プロパティ

dependencies The Dependencies tab allows to declare data dependencies between layers. A data dependency occurs when a data modification in a layer, not by direct user manipulation, may modify data of other layers. This is the case for instance when geometry of a layer is updated by a database trigger or custom PyQGIS scripting after modification of another layer's geometry.

In the Dependencies tab, you can select any layers which may externally alter the data in the current layer. Correctly specifying dependent layers allows QGIS to invalidate caches for this layer when the dependent layers are altered.

14.1.18. 凡例プロパティ

legend The Legend properties tab provides you with advanced settings for the Layers panel and/or the print layout legend. These options include:

  • checkbox Text on symbols: In some cases it can be useful to add extra information to the symbols in the legend. With this frame, you can affect to any of the symbols used in the layer symbology a text that is displayed over the symbol, in both Layers panel and print layout legend. This mapping is done by typing each text next to the symbol in the table widget or filling the table using the Set Labels from Expression button. Text appearance is handled through the font and color selector widgets of the Text Format button.

../../../_images/text_legend_symbols.png

図 14.62 Setting text on symbols (left) and its rendering in the Layers panel (right)

  • a list of widgets you can embed within the layer tree in the Layers panel. The idea is to have a way to quickly access some actions that are often used with the layer (setup transparency, filtering, selection, style or other stuff...).

    デフォルトで、QGISでは透明ウィジェットを提供していますが、これは、独自のウィジェットを登録するプラグインによって拡張し、それらが管理するレイヤーにカスタムアクションを割り当てることができます。

14.1.19. QGISサーバープロパティ

overlay The QGIS Server tab consists of Description, Attribution, MetadataURL, and LegendUrl sections.

From the Description section, you can change the Short name used to reference the layer in requests (to learn more about short names, read レイヤー、グループ、およびプロジェクトの短い名前). You can also add or edit a Title and Abstract for the layer, or define a Keyword list here. These keyword lists can be used in a metadata catalog. If you want to use a title from an XML metadata file, you have to fill in a link in the DataUrl field.

帰属 を使用してXMLメタデータ・カタログから属性データを取得します。

メタデータUrl では、XMLメタデータカタログへの一般的なパスを定義できます。この情報は、その後のセッションのためのQGISプロジェクトファイルに保存され、QGISサーバーに使用されます。

凡例Url セクションでは、URLフィールドに、凡例画像のURLを提供できます。画像の適切なフォーマットを適用する書式のドロップダウンオプションを使用できます。現在、PNG、JPGやJPEG画像フォーマットがサポートされています。

../../../_images/vector_server_properties.png

図 14.63 QGIS Server tab in vector layers properties dialog

To learn more about QGIS Server, read the QGIS Server Guide/Manual.

14.1.20. デジタイズプロパティ

digitizing The Digitizing tab gives access to options that help to ensure the quality of digitized geometries.

../../../_images/vector_digitizing_properties.png

図 14.64 The QGIS Digitizing tab in the vector layers properties dialog

14.1.20.1. Automatic Fixes

自動修正 セクションのオプションは、追加または修正されたジオメトリの頂点に直接影響を与えます。 checkbox 重複ノードの削除 オプションがチェックされている場合、全く同じ座標の連続する2頂点が削除されます。guilabel:ジオメトリ精度 が設定されている場合、すべての頂点は、設定されたジオメトリ精度の最も近い倍数に丸められます。丸めはレイヤ座標参照系で行われます。Z と M の値は丸められません。多くの地図ツールでは、デジタイズ中にグリッドがキャンバスに表示されます。

14.1.20.2. Geometry Checks

In the Geometry checks section, additional validations on a per geometry basis can be activated. Immediately after any geometry modification, failures in these checks are reported to the user in the geometry validation panel. As long as a check is failing, it is not possible to save the layer. The checkbox Is valid check will run basic validity checks like self intersection on geometries.

14.1.20.3. Topology Checks

In the Topology checks section, additional topology validation checks can be activated. Topology checks will be executed when the user saves the layer. Check errors will be reported in the geometry validation panel. As long as validation errors are present, the layer can not be saved. Topology checks are executed in the area of the bounding box of the modified features. Since other features may be present in the same area, topological errors concerning these features are reported as well as errors introduced in the current edit session.

Topology check option

Illustration

The checkbox Gap check will check for gaps between neighbouring polygons.

../../../_images/gapcheck.png

The checkbox Overlap check will check for overlaps between neighbouring polygons.

../../../_images/overlapcheck.png

The checkbox Missing vertex check will check for shared boundaries of neighbouring polygons where one border misses a vertex which is present on the other one.

../../../_images/missingvertexcheck.png

14.1.20.3.1. Gap check exceptions

Sometimes it is desirable to keep gaps inside an area in a polygon layer that otherwise is fully covered by polygons. For example, a land use layer may have acceptable holes for lakes. It is possible to define areas that are ignored in the gap check. Since gaps inside these areas are allowed, we will refer to them as Allowed Gaps areas.

In the options for the gap checks under Allowed Gaps, an Allowed Gaps layer can be configured.

Whenever the gap check is executed, gaps which are covered by one or more polygons in the Allowed Gaps Layer are not reported as topology errors.

It is also possible to configure an additional Buffer. This buffer is applied to each polygon on the Allowed Gaps Layer. This makes it possible to make the tests less susceptible to small changes in the outlines at the borders of gaps.

When Allowed Gaps are enabled, an additional button (Add Allowed Gap) for detected gap errors is available in the geometry validation dock, where gaps are reported during digitizing. If the Add Allowed Gap button is pushed, a new polygon with the geometry of the detected gap is inserted into the Allowed Gaps Layer. This makes it possible to quickly flag gaps as allowed.