` `
Der Layereigenschaften Dialog für Vektorlayer enthält generelle Einstellungen, um das Aussehen der Layerobjekte in der Karte (Symbologie, Beschriftung, Diagramme) und die Interaktion mit der Maus (Aktionen, Kartentipps, form design) zu verwalten. Es bietet auch Informationen über die Layer.
To access the Layer Properties dialog, double-click on a layer in the legend or right-click on the layer and select Properties from the pop-up menu.
Bemerkung
Depending on the external plugins you have installed, new tabs may be added to the layer properties dialog. Those are not presented below.
Tipp
Live update rendering
The Layer Styling Panel provides you with some of the common features of the Layer properties dialog and is a good modeless widget that you can use to speed up the configuration of the layer styles and automatically view your changes in the map canvas.
Bemerkung
Because properties (symbology, label, actions, default values, forms...) of embedded layers (see Layer/Gruppen einbinden) are pulled from the original project file and to avoid changes that may break this behavior, the layer properties dialog is made unavailable for these layers.
Use this tab to make general settings for the vector layer. There are several options available:
You can set the Maximum (inclusive) and Minimum (exclusive) scale, defining a range of scale in which features will be visible. Out of this range, they are hidden. The Set to current canvas scale button helps you use the current map canvas scale as boundary of the range visibility. See Maßstabsabhängige Layeranzeige for more information.
Under the Provider Feature Filter frame, the Query Builder allows you to define a subset of the features in the layer using a SQL-like WHERE clause and to display the result in the main window. As long as the query is active, only the features corresponding to its result are available in the project. The query result can be saved as a new vector layer.
The Query Builder is accessible through the eponym term at the bottom of the General tab in the Layer Properties. Under Feature subset, click on the [Query Builder] button to open the Query builder. For example, if you have a regions layer with a TYPE_2 field, you could select only regions that are borough in the Provider specific filter expression box of the Query Builder. Figure_vector_querybuilder shows an example of the Query Builder populated with the regions.shp layer from the QGIS sample data. The Fields, Values and Operators sections help you to construct the SQL-like query.
The Fields list contains all attribute columns of the attribute table to be searched. To add an attribute column to the SQL WHERE clause field, double click its name in the Fields list. Generally, you can use the various fields, values and operators to construct the query, or you can just type it into the SQL box.
The Values list lists the values of an attribute table. To list all possible values of an attribute, select the attribute in the Fields list and click the [all] button. To list the first 25 unique values of an attribute column, select the attribute column in the Fields list and click the [Sample] button. To add a value to the SQL WHERE clause field, double click its name in the Values list.
The Operators section contains all usable operators. To add an operator to the SQL WHERE clause field, click the appropriate button. Relational operators ( = , > , ...), string comparison operator (LIKE), and logical operators (AND, OR, ...) are available.
The [Test] button shows a message box with the number of features satisfying the current query, which is useful in the process of query construction. The [Clear] button clears the text in the SQL WHERE clause text field. The [OK] button closes the window and selects the features satisfying the query. The [Cancel] button closes the window without changing the current selection.
QGIS treats the resulting subset acts as if it were the entire layer. For example if you applied the filter above for ‘Borough’, you can not display, query, save or edit Anchorage, because that is a ‘Municipality’ and therefore not part of the subset.
The only exception is that unless your layer is part of a database, using a subset will prevent you from editing the layer.
The Style 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 Layerdarstellung widget.
Tipp
Symbologie exportierten
Sie haben die Option die Vektorsymbologie von QGIS nach Google *.kml, *.dxf und MapInfo .*.tab Dateien zu exportieren. Öffnen Sie einfach das Rechte-Maustasten-Menü des Layers und klicken Sie auf Speichern als ... ` um den Namen der Ausgabedatei und ihr Format festzulegen. Verwenden Sie im Dialog das :guilabel:`Darstellungsexport Menü um die Symbologie entweder als Objektdarstellung ‣ oder Symbollayerdarstellung ‣ zu speichern. Wenn Sie Symbollayer verwendet haben wird empfohlen die zweite Einstellung zu benutzen.
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.
Es gibt keinen kontinuirliche Farbe Renderer da es in der Tat einfach ein spezieller Fall des Abgestuft Renderers ist. Die Kategorisiert und Abgestuft Renderer können erstellt werden indem ein Symbol und ein Farbverlauf festgelegt werden - Sie werden die Farben für Symbole angemessen einsetzen. Für jeden Datentyp (Punkte, Linien und Polygone) sind Symbollayertypen erhältlich. Abhängig vom ausgesuchten Renderer gibt es verschiedene zusätzliche Bereiche.
Bemerkung
Wenn Sie den Darstellungstyp beim Einstellen des Stils eines Vektorlayers ändern werden die Einstellungen für das Symbol beibehalten. Beachten Sie dass dieses Vorgehen nur für eine Änderunge funktioniert. Wenn Sie den Darstellungstyp wiederholt ändern gehen die Einstellungen für das Symbol verloren.
The Single Symbol renderer is used to render all features of the layer using a single user-defined symbol. See Die Symbolauswahl for further information about symbol representation.
Tipp
Edit symbol directly from layer panel
If in your Layers Panel you have layers with categories defined through categorized, graduated or rule-based style mode, you can quickly change the fill color of the symbol of the categories by right-clicking on a category and choose the color you prefer from a color wheel menu. Right-clicking on a category will also give you access to the options Hide all items, Show all items and Edit symbol.
The No Symbols renderer is a special use case of the Single Symbol renderer as it applies the same rendering to all features. Using this renderer, no symbol will be drawn for features, but labeling, diagrams and other non-symbol parts will still be shown.
Selections can still be made on the layer in the canvas and selected features will be rendered with a default symbol. Features being edited will also be shown.
This is intended as a handy shortcut for layers which you only want to show labels or diagrams for, and avoids the need to render symbols with totally transparent fill/border to achieve this.
The 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. The Categorized menu allows you to
select an existing field (using the Column listbox) or
type or build an expression using the Set column expression. The expression used to classify features can be of any type; it can for example:
be a comparison, e.g. myfield >= 100, $id = @atlas_featureid, myfield % 2 = 0, within( $geometry, @atlas_geometry ). In this case, QGIS returns values 1 (True) and 0 (False).
combine different fields, e.g. concat( field1, ' ', field2 ) particularly useful when you want to process classification on two or more fields simultaneously.
be a calculation on fields, e.g. myfield % 2, year( myfield ) field_1 + field_2.
be used to transform linear values in discrete classes, e.g.:
CASE WHEN x > 1000 THEN 'Big' ELSE 'Small' END
combine several discrete values in one single category, e.g.:
CASE
WHEN building IN ('residence', 'mobile home') THEN 'residential'
WHEN building IN ('commercial', 'industrial') THEN 'Commercial and Industrial'
END
Bemerkung
While you can use any kind of expression to categorize features, for some complex expressions it might be simpler to use rule-based rendering.
the symbol (using the Die Symbolauswahl dialog) which will be used as base symbol for each class;
the range of colors (using the Color ramp listbox) from which color applied to the symbol is selected.
Then click on [Classify] button to create classes from the distinct value of the attribute column. Each class can be disabled unchecking the checkbox at the left of the class name.
Sie können das Symbol, den Wert oder die Beschriftung verändern, klicken Sie einfach auf das Element, das Sie ändern wollen.
Ein Rechtsklick zeigt ein Kontextmenü für Kopieren/Einfügen, Farbe ändern, Transparenz ändern, Ausgabeeinheit ändern, Breite ändern.
The example in figure_categorized_symbology shows the category rendering dialog used for the rivers layer of the QGIS sample dataset.
Tipp
Auswahl und Ändern von Mehrfachsymbolen
Mit der Symbologie können Sie Mehrfachsymbole auswählen und Rechtsklicken um Farbe, Transparenz, Größe oder Breite der ausgewählten Einträge zu ändern.
Tipp
Kategorien Symbolnamen zuordnen
Im Menü [Erweitert] unter den Klassen, können Sie eine der beiden Aktionen wählen, um Symbolnamen auf einen entsprechenden Kategorienamen in Ihrer Klassifizierung aufeinander abzustimmen. Matched to saved symbols Kategorienamen auf einen Symbolnamen aus Ihrem Stilmanager anpassen. Match to symbols from file Kategorienamen auf Symbolnamen von einer externen Datei anpassen.
The 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.
Like the Categorized Renderer, the Graduated Renderer allows you to define rotation and size scale from specified columns.
Genauso können Sie -analog zum Kategorisierten Renderer - im Menü auswählen:
Das Symbol (nutzen des Symbolauswahl Dialogs)
Die Legendenformatierung und die Genauigkeit
Die Methode, um das Symbol zu ändern: Farbe oder Größe
Die Farben (indem man die Farbverlaufsliste verwendet), wenn die Farbmethode ausgewählt ist
Then you can use the Histogram tab which shows an interactive histogram of the values from the assigned field or expression. Class breaks can be moved or added using the histogram widget.
Bemerkung
Sie können die statistische Zusammenfassung nutzen, um mehr Informationen über Ihren Vektorlayer zu erhalten. Siehe Statistical Summary Panel.
Zurück zu dem Klassen Reiter, Sie können die Anzahl der Klassen und auch den Modus für das Klassifizieren von Objekten innerhalb der Klassen (indem man die Modus-Liste verwendet) einstellen. Die möglichen Modi sind:
Schöne Unterbrechungen: Berechnet eine Sequenz von etwa n+1 mit gleichem Abstand, die den Bereich der Werte in x decken. Die Werte sind so gewählt, dass sie 1, 2 oder 5 mal einer Potenz von 10 sind .(basiert ziemlich auf der R statistischen Umgebung http://astrostatistics.psu.edu/datasets/R/html/base/html/pretty.html)
The listbox in the center part of the Style tab lists the classes together with their ranges, labels and symbols that will be rendered.
Klicken Sie auf den Klassifizieren Knopf um Klassen anhand des ausgewählten Modus zu erstellen. Jede Klasse kann anhand des Deaktivierens des Kontrollkästchens links neben dem Klassennamen ausgeschaltet werden.
Sie können das Symbol, den Wert oder die Beschriftung verändern, klicken Sie einfach auf das Element, das Sie ändern wollen.
Ein Rechtsklick zeigt ein Kontextmenü für Kopieren/Einfügen, Farbe ändern, Transparenz ändern, Ausgabeeinheit ändern, Breite ändern.
The example in figure_graduated_symbology shows the graduated rendering dialog for the rivers layer of the QGIS sample dataset.
Tipp
Thematische Karten anhand von Ausdrücken erstellen
Categorized and graduated thematic maps can be created using the result of an expression. In the properties dialog for vector layers, the attribute chooser is extended with a Set column expression function. So you don’t need to write the classification attribute to a new column in your attribute table if you want the classification attribute to be a composite of multiple fields, or a formula of some sort.
Proportional Symbol and Multivariate Analysis are not rendering types available from the Style rendering drop-down list. However with the Size Assistant options applied over any of the previous rendering options, QGIS allows you to display your point and line data with such representation.
Proportionale Symbole erstellen
Proportional rendering is done by first applying to the layer the Einzelsymbol Darstellung. Once you set the symbol, at the upper level of the symbol tree, the Data-defined override button available beside Size or Width options (for point or line layers respectively) provides tool to create proportional symbology for the layer. An assistant is moreover accessible through the menu to help you define size expression.
The assistant lets you define:
To the right side of the dialog, you can preview the features representation within a live-update widget. This representation is added to the layer tree in the layer legend and is also used to shape the layer representation in the print composer legend item.
The values presented in the varying size assistant above will set the size ‘Data-defined override’ with:
coalesce(scale_exp(Importance, 1, 20, 2, 10, 0.57), 1)
Mehrdimensionale Analyse erzeugen
Eine mehrdimensionale Analyse hilft Ihnen, die Beziehungen zwischen zwei oder mehr Variablen auszuwerten z. B. kann eine als Farbverlauf und die andere als Größe dargestellt werden.
The simplest way to create multivariate analysis in QGIS is to first apply a categorized or graduated rendering on a layer, using the same type of symbol for all the classes. Then, clicking on the symbol [Change] button above the classification frame, you get the Die Symbolauswahl dialog from which, as seen above, you can activate and set the size assistant option either on size (for point layer) or width (for line layer).
Like the proportional symbol, the size-related symbol is added to the layer tree, at the top of the categorized or graduated classes symbols. And both representation are also available in the print composer legend item.
The 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. 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, activate an existing row by double-clicking on it, or click on ‘+’ and click on the new rule. In the Rule properties dialog, you can define a label for the rule. Press the button to open the expression string builder. In the Function List, click on Fields and Values to view all attributes of the attribute table to be searched. To add an attribute to the field calculator Expression field, double click on its name in the Fields and Values list. Generally, you can use the various fields, values and functions to construct the calculation expression, or you can just type it into the box (see Ausdrücke). You can create a new rule by copying and pasting an existing rule with the right mouse button. You can also use the ‘ELSE’ rule that will be run if none of the other rules on that level matches. Since QGIS 2.8 the rules appear in a tree hierarchy in the map legend. Just double-click the rules in the map legend and the Style tab of the layer properties appears showing the rule that is the background for the symbol in the tree.
The example in figure_rule_based_symbology shows the rule-based rendering dialog for the rivers layer of the QGIS sample dataset.
The Point Displacement renderer works to visualize all features of a point layer, even if they have the same location. To do this, the symbols of the points are placed on a displacement circle around one center symbol or on several concentric circles.
Bemerkung
You can still render features with other renderer like Single symbol, Graduated, Categorized or Rule-Based renderer using the Renderer drop-down list then the Renderer Settings... button.
The Inverted Polygon renderer allows user to define a symbol to fill in outside of the layer’s polygons. As above you can select subrenderers, namely Single symbol, Graduated, Categorized, Rule-Based or 2.5D renderer.
With the Heatmap renderer you can create live dynamic heatmaps for (multi)point layers. You can specify the heatmap radius in pixels, mm or map units, 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.
Using the 2.5D renderer it’s possible to create a 2.5D effect on your layer’s features. You start by choosing a Height value (in map units). For that you can use a fixed value, one of your layer’s fields, or an expression. You also need to choose an Angle (in degrees) to recreate the viewer position (0° means west, growing in counter clock wise). Use advanced configuration options to set the Roof Color and Wall Color. If you would like to simulate solar radiation on the features walls, make sure to check the Shade walls based on aspect option. You can also simulate a shadow by setting a Color and Size (in map units).
Tipp
Using 2.5D effect with other renderers
Once you have finished setting the basic style on the 2.5D renderer, you can convert this to another renderer (single, categorized, graduated). The 2.5D effects will be kept and all other renderer specific options will be available for you to fine tune them (this way you can have for example categorized symbols with a nice 2.5D representation or add some extra styling to your 2.5D symbols). To make sure that the shadow and the “building” itself do not interfere with other nearby features, you may need to enable Symbols Levels ( Advanced ‣ Symbol levels...). The 2.5D height and angle values are saved in the layer’s variables, so you can edit it afterwards in the variables tab of the layer’s properties dialog.
From the Style tab, you can also set some options that invariabily act on all features of the layer:
Layer transparency : 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 the menu beside the slider.
Layer blending mode and Feature blending mode: 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 Mischmodi.
Wenden Sie Zeicheneffekte auf alle Layerobjekte an, mit dem Zeicheneffekte Knopf.
Control feature rendering order allows you, using features attributes, to define the z-order in which they shall be rendered. Activate the checkbox and click on the button beside. You then get the Define Order dialog in which you:
You can add several rules of ordering. The first rule is applied to all the features in the layer, z-ordering them according to the value returned. Then, for each group of features with the same value (including those with NULL value) and thus same z-level, the next rule is applied to sort its items among them. And so on...
Für Renderer, die Symbollayer gestapelt ermöglichen (nur Heatmap nicht) gibt es eine Option, um die Darstellungsreihenfolge der einzelnen Symbolebenen zu steuern.
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.
Um die Symbolebenen zu aktivieren, wählen Sie Symbolebenen aktivieren. Jede Reihe zeigt eine kleine Vorschau des kombinierten Symbols, seiner Beschriftung und die individuellen Symbollayer, unterteilt in verschiedene Spalten mit einer Nummer. Die Nummern zeigen die Darstellungsreihenfolge, in der die Symbollayer gezeichnet werden. Niedrige Werteebenen werden zuerst gezeichnet, liegen ganz unten, während höhere Werte als letztes gezeichnet werden und über den anderen liegen.
Bemerkung
Wenn Symbolebenen deaktiviert werden, werden alle Symbole entsprechend ihren jeweiligen Objektreihenfolge gezeichnet. Überlappende Symbole werden einfach zu anderen darunter verschleiert. Außerdem “verschmelzen” ähnliche Symbole nicht mit anderen.
Damit die Layerdarstellung verbessert und vermieden (oder zumindest reduziert) wird, dass andere Software auf die endgültige Darstellung der Karte umsortiert, bietet QGIS eine weitere leistungsfähige Funktionalität: Die Option Zeicheneffekte, die zur Anpassung Zeicheneffekte für die Visualisierung von Vektorlayern hinzufügt.
The option is available in the Layer Properties –> Style 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 Draw effects option and clicking the Customize effects button, that will open the Effect Properties Dialog (see figure_effects_source). 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 transparency of its style can be adjusted.
Blur: Adds a blur effect on the vector layer. The options that someone can change are the Blur type (Stack or Gaussian blur), the strength and transparency of the blur effect.
Colorize: 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 Grayscale to select how to create it (options are: ‘lightness’, ‘luminosity’ and ‘average’). If Colorise is selected, it will be possible to mix another color and choose how strong it should be. You can also control the Brightness, contrast and saturation levels of the resulting symbol.
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 degrees and radius, 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, the transparency and the color of the effect.
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.
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, with a single color or a color ramp.
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.
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 4 other options are:
There are some common options available for all draw effect types. Transparency and Blend mode options work similar to the ones described in Layerdarstellung and can be used in all draw effects except for the transform one.
One or more draw effects can used at the same time. You activate/deactivate an effect using its checkbox in the effects list. You can change the selected effect type by using the Effect type option. You can reorder the effects using Move up and Move down buttons, and also add/remove effects using the Add effect and Remove effect buttons.
There is also a Draw mode option available for every draw effect, and you can choose whether to render and/or to modify the symbol. Effects render from top to bottom.’Render only’ mode means that the effect will be visible while the ‘Modify 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 in 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).
The 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 Layer Labeling Options icon of the Labels toolbar.
The first step is to choose the labeling method from the drop-down list. There are four options available:
The next steps assume you select the Show labels for this layer option, enabling following tabs that help you configure the labeling:
It also enables the Label with drop-down list, from which you can select an attribute column to use. Click if you want to define labels based on expressions - See Ausdrucksbasierte Beschriftungen definieren.
The following steps describe simple labeling without using the Data defined override functions, which are situated next to the drop-down menus - see Datendefinierte Übersteuerung für das Beschriften for a use case.
In the Text tab, you can define the Font, Style, and Size of your labels’ text (see Figure_labels). There are options available to set the labels’ Color and Transparency. Use the Type case option to change the capitalization style of the text. You have the possibility to render the text as ‘All uppercase’, ‘All lowercase’ or ‘Capitalize first letter’. In Spacing, you can change the space between words and between individual letters. Finally, use the Blend mode option to determine how your labels will mix with the map features below them (see more about it in Mischmodi).
The Apply label text substitutes option gives you ability to specify a list of texts to substitute to texts in feature labels (e.g., abbreviating street types). Replacement texts are thus used to display labels in the map canvas. Users can also export and import lists of substitutes to make reuse and sharing easier.
In the Formatting tab, you can define a character for a line break in the labels with the Wrap on character option. You can also format the Line Height and the alignment. For the latter, typical values are available (left, right, and center), plus Follow label placement for point layers. When set to this mode, text alignment for labels will be dependent on the final placement of the label relative to the point. E.g., if the label is placed to the left of the point, then the label will be right aligned, while if it is placed to the right, it will be left aligned.
For line vector layers you can include Line directions symbols to help determine the lines directions. They work particularly well when used with the curved or Parallel placement options from the Placement tab. There are options to set the symbols position, and to reverse direction.
Use the Formatted numbers option to format numeric labels. You can set the number of Decimal places. By default, 3 decimal places will be used. Use the Show plus sign if you want to show the plus sign in positive numbers.
To create a buffer around the labels, activate the Draw text buffer checkbox in the Buffer tab. You can set the buffer’s Size, color, and Transparency. The buffer expands from the label’s outline , so, if the color buffer’s fill checkbox is activated, the buffer interior is filled. This may be relevant when using partially transparent labels or with non-normal blending modes, which will allow seeing behind the label’s text. Deactivating color buffer’s fill checkbox (while using totally transparent labels) will allow you to create outlined text labels.
In the Background tab, you can define with Size X and Size Y the shape of your background. Use Size type to insert an additional ‘Buffer’ into your background. The buffer size is set by default here. The background then consists of the buffer plus the background in Size X and Size Y. You can set a Rotation where you can choose between ‘Sync with label’, ‘Offset of label’ and ‘Fixed’. Using ‘Offset of label’ and ‘Fixed’, you can rotate the background. Define an Offset X,Y with X and Y values, and the background will be shifted. When applying Radius X,Y, the background gets rounded corners. Again, it is possible to mix the background with the underlying layers in the map canvas using the Blend mode (see Mischmodi).
Use the Shadow tab for a user-defined Drop shadow. The drawing of the background is very variable. Choose between ‘Lowest label component’, ‘Text’, ‘Buffer’ and ‘Background’. The Offset angle depends on the orientation of the label. If you choose the Use global shadow checkbox, then the zero point of the angle is always oriented to the north and doesn’t depend on the orientation of the label. You can influence the appearance of the shadow with the Blur radius. The higher the number, the softer the shadows. The appearance of the drop shadow can also be altered by choosing a blend mode.
Choose the Placement tab for configuring label placement and labeling priority. Note that the placement options differ according to the type of vector layer, namely point, line or polygon.
With the Cartographic placement mode, point labels are generated with a better visual relationship with the point feature, following ideal cartographic placement rules. Labels can be placed at a set Distance either from the point feature itself or from the bounds of the symbol used to represent the feature. The latter option is especially useful when the symbol size isn’t fixed, e.g. if it’s set by a data defined size or when using different symbols in a categorized renderer.
Standardmäßig sind die Platzierungen in dieser Reihenfolge festgelegt:
oben rechts
oben links
unten rechts
unten links
mitte rechts
mitte links
oben, leicht rechts
unten, leicht rechts
Placement priority can, however, be customized or set for an individual feature using a data defined list of prioritised positions. This also allows only certain placements to be used, so e.g. for coastal features you can prevent labels being placed over the land.
Die Einstellung Um den Punkt platziert die Beschriftung in einem gleichen Kreisradius (einzustellen in Abstand) um das Objekt. Die Platzierung der Beschriftung kann auch eingeschränkt werden, in der Quadrant Option.
With the Offset from point, labels are placed at a fixed offset from the point feature. You can select the Quadrant in which to place your label. You are also able to set the Offset X,Y distances between the points and their labels and can alter the angle of the label placement with the Rotation setting. Thus, placement in a selected quadrant with a defined rotation is possible.
Label options for line layers include Parallel, Curved or Horizontal. For the Parallel and Curved options, you can set the position to Above line, On line and Below line. It’s possible to select several options at once. In that case, QGIS will look for the optimal label position. For Parallel and curved placement options, you can also use the line orientation for the position of the label. Additionally, you can define a Maximum angle between curved characters when selecting the Curved option (see Figure_labels_placement_line).
For all three placement options, in Repeat, you can set up a minimum distance for repeating labels. The distance can be in mm or in map units.
You can choose one of the following options for placing labels in polygons (see figure_labels_placement_polygon):
In the Offset from centroid settings you can specify if the centroid is of the visible polygon or whole polygon. That means that either the centroid is used for the polygon you can see on the map or the centroid is determined for the whole polygon, no matter if you can see the whole feature on the map. You can place your label within a specific quadrant, and define offset and rotation.
The Around centroid setting places the label at a specified distance around the centroid. Again, you can define visible polygon or whole polygon for the centroid.
With the Horizontal (slow) or Free (slow) options, QGIS places at the best position either a horizontal or a rotated label inside the polygon.
With the Using perimeter option, the label will be drawn next to the polygon boundary. The label will behave like the parallel option for lines. You can define a position and a distance for the label. For the position, Above line, On line, Below line and Line orientation dependent position are possible. You can specify the distance between the label and the polygon outline, as well as the repeat interval for the label.
The Using perimeter (curved) option helps you draw the label along the polygon boundary, using a curved labeling. In addition to the parameters available with Using perimeter setting, you can set the Maximum angle between curved characters polygon, either inside or outside.
In the priority section you can define the priority with which labels are rendered for all three vector layer types (point, line, polygon). This placement option interacts with the labels from other vector layers in the map canvas. If there are labels from different layers in the same location, the label with the higher priority will be displayed and the others will be left out.
In the Rendering tab, you can tune when the labels can be rendered and their interaction with other labels and features.
Unter den Beschriftungsoptionen finden Sie die skalierungsbasierte und die Pixelgrößenbasierte Sichtbarkeitseinstellungen.
Der Beschriftung Z-Index bestimmt, in welcher Reihenfolge, welche Beschriftung dargestellt wird, als auch in welcher Verbindung mit anderen Objekten in dem Layer (nutzen Sie datendefinierte Übersteuerung), wie mit Beschriftungen anderer Layer. Beschriftungen mit einem hohen Z-Index werden an oberster Stelle dargestellt.
Zusätzlich ist die Logik optimiert worden, so, dass wenn zwei Beschriftungen den selben Z-Index haben, dann:
wenn sie aus dem selben Layer sind, wird die kleinere Beschriftung über dem größeren gezeichnet
wenn sie aus verschiedenen Layer sind, werden die Beschriftungen in der selben Reihenfolge gezeichnet, wie die Layer an sich (d. h. unter Berücksichtigung der Reihenfolge in der Kartenlegende).
Beachten Sie, dass diese Einstellung Beschriftungen nicht unter andere Objekte anderer Layer zeichnet, es kontrolliert nur die Reihenfolge, in welcher Beschriftungen über allen Layerobjekten gezeichnet werden.
Während der Darstellung der Beschriftungen und um lesbare Beschriftungen anzuzeigen, wertet QGIS automatisch die Position der Beschriftungen aus und kann, im Falle einer Kollision, einige von ihnen verstecken. Trotzdem können Sie Alle Beschriftungen für diesen layer anzeigen (including colliding labels) wählen und Ihre Kollisionen manuell beheben.
Mit datendefinierten Ausdrücken in Beschriftungen anzeigen and Immer anzeigen können Sie Feineinstellungen vornehmen, welche Beschriftungen dargestellt werden.
Unter Objektoptionen können Sie Jeden Teil eines Multi-Polygons beschriften und Begrenze die Anzahl der zu beschriftenden Objekte wählen. Sowohl Linien- als auch Polygonlayer bieten die Möglichkeit eine Mindestgröße für das Beschriften einzustellen, wählen Sie Unterdrücke Beschriftungen für Objekte kleiner als. Für Polygonlayer können Sie auch einen Filter vornehmen, der Beschriftungen anzeigt, wenn sie komplett in dem Polygon liegen oder nicht. Für Linienlayer können Sie wählen Verschmelze verbundene Linien um doppelte Beschriftung zu vermeiden, um eine lebhafte Karte darzustellen in Verbindung mit dem Abstand oder Wiederholen Optionen im Reiter Platzierung.
In dem Hindernis Rahmen, können Sie die Abdeckungsbeziehungen zwischen Beschriftungen und Objekten bearbeiten. Aktivieren Sie die Discourage labels from covering features Option um zu entscheiden, ob Objekte des Layers als Hindernis für Beschriftung wirken soll (inklusive Beschriftungen anderer Objekte des selben Layers). Ein Hindernis ist ein Merkmal, QGIS versucht so weit wie möglich keine Beschriftungen übereinander zu platzieren. Anstatt des gesamten Layers, können Sie Teilmengen als Hindernis definieren, indem Sie datendefinierte Übersteuerung verwenden.
Der Prioritätsschieberegler für Hindernisse erlaubt es Ihnen Beschriftungen von bestimmten Layern zum überlappen zu bevorzugen. Eine Geringe Gewichtung einer Hindernispriorität bedeutet, dass Objekte eines Layers weniger als Hindernis gelten und somit eher durch Beschriftungen überlagert werden. Die Priorität kann ebenso datendefiniert sein, so dass innerhalb des selben Layers, bestimmte Objekte wahrscheinlicher überdeckt werden als andere.
Für Polygonlayer können Sie dezArt von Hindernisobjekten wählen durch Minimierung der Beschriftungsplatzierung sein könnten:
With rule-based labeling multiple label configurations can be defined and applied selectively on the base of expression filters and scale range, as in Rule-based rendering.
To create a rule, select the Rule-based labeling option in the main drop-down list from the Labels tab and click the 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.
A summary of existing rules is shown in the main dialog (see figure_labels_rule_based). You can add multiple rules, reorder or imbricate them with a drag-and-drop. You can as well remove them with the button or edit them with button or a double-click.
Whether you choose simple or rule-based labeling type, QGIS allows using expressions to label features. Click the icon near the Label with drop-down list in the Labels tab of the properties dialog. In figure_labels_expression, you see a sample expression to label the alaska regions with name and area size, based on the field ‘NAME_2’, some descriptive text, and the function $area in combination with format_number() to make it look nicer.
Expression based labeling is easy to work with. All you have to take care of is that:
Schauen wir uns einige Beispiele an:
Label based on two fields ‘name’ and ‘place’ with a comma as separator:
"name" || ', ' || "place"
Returns:
John Smith, Paris
Label based on two fields ‘name’ and ‘place’ with other texts:
'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")
Returns:
My name is John Smith and I live in Paris
Label based on two fields ‘name’ and ‘place’ with other texts combining different concatenation functions:
concat('My name is ', name, ' and I live in ' || place)
Returns:
My name is John Smith and I live in Paris
Or, if the field ‘place’ is NULL, returns:
My name is John Smith
Multi-line label based on two fields ‘name’ and ‘place’ with a descriptive text:
concat('My name is ', "name", '\n' , 'I live in ' , "place")
Returns:
My name is John Smith
I live in Paris
Label based on a field and the $area function to show the place’s name and its rounded area size in a converted unit:
'The area of ' || "place" || ' has a size of '
|| round($area/10000) || ' ha'
Returns:
The area of Paris has a size of 10500 ha
Create a CASE ELSE condition. If the population value in field population is <= 50000 it is a town, otherwise it is a city:
concat('This place is a ',
CASE WHEN "population <= 50000" THEN 'town' ELSE 'city' END)
Returns:
This place is a town
Wie Sie im Ausdruckeditor sehen können stehen Ihnen hunderte von Funktionen zur Verfügung um einfache und sehr komplexe Ausdrücke zumBeschriften Ihrer Daten in QGIS zu erstellen. Siehe das Ausdrücke Kapitel für weitere Informationen und ein Beispiel zu Ausdrücken.
With the Data defined override functions, the settings for the labeling are overridden by entries in the attribute table. It can be used to set values for most of the labeling options described above. See the widget’s description and manipulation in Datendefinierte Übersteuerung Setup section.
The Label Toolbar provides some tools to manipulate label or diagram properties, but only if the corresponding data-defined option is indicated (otherwise, buttons are disabled). Layer might also need to be in edit mode.
While for readability, label has been used below to describe the Label toolbar, note that when mentioned in their name, the tools work almost the same way with diagrams:
Warnung
Label tools overwrite current field values
Using the Label toolbar to customize the labeling actually writes the new value of the property in the mapped field. Hence, be careful to not inadvertently replace data you may need later!
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 Move label function (see figure_labels_data_defined).
Importieren Sie lakes.shp aus dem QGIS Beispieldatensatz.
Doppelklicken Sie den Layer um die Layereigenschaften zu öffnen. Klicken Sie auf Beschriftungen und Platzierung. Wählen Sie Abstand vom Punkt.
Look for the Data defined entries. Click the icon to define the field type for the Coordinate. Choose xlabel for X and ylabel for Y. The icons are now highlighted in yellow.
Zoomen Sie auf einen See.
Go to the Label toolbar and click the icon. Now you can shift the label manually to another position (see figure_labels_move). The new position of the label is saved in the xlabel and ylabel columns of the attribute table.
Using The Geometry Generator with the expression below, you can also add a linestring symbol layer to connect each lake to its moved label:
make_line( centroid( $geometry ), make_point( "xlabel", "ylabel" ) )
The Fields tab helps you organize the fields of the selected dataset and the way you can interact with the feature’s attributes. The buttons New field and Delete field can be used when the dataset is in Editing mode.
You can rename fields by double-clicking in the fields name (note that you should switch to editing mode to edit the field name). This is only supported for data providers like PostgreSQL, Oracle, Memory layer and some OGR layer depending the OGR data format and version.
You can define some alias to display human readable fields in the feature form or the attribute table. In this case, you don’t need to switch to editing mode. Alias are saved in project file.
Comments can be added by clicking in the comment field of the column but if you are using a PostgreSQL layer, comment of the column could be the one in the PostgreSQL table if set. Comments are saved in the QGIS project file as for the alias.
The dialog also lists read-only characteristics of the field 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.
Within the Fields tab, you also find an Edit widget column. This column can be used to define values or a range of values that are allowed to be added to the specific attribute table column. It also helps to set the type of widget used to fill or display values of the field, in the attribute table or the feature form. If you click on the [Edit widget] button, a dialog opens, where you can define different widgets.
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:
Editable: uncheck this to set the field read-only (not manually modifiable) when the layer is in edit mode. Note that checking this setting doesn’t override any edit limitation from the provider.
Label on top: places the field name above or beside the widget in the feature form
Default value: for new features, automatically populates by default the field with a predefined value or an expression-based one. For example, you can:
A preview of the resulting default value is displayed at the bottom of the widget.
Bemerkung
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.
Constraints: you can constrain the value to insert in the field. This constraint can be:
based on a custom expression: e.g. regexp_match(col0,'A-Za-z') to ensure that the value of the field col0 has only alphabetical letter.
A short description of the constraint can be added and will be displayed at the top of the form as a warning message when the value supplied does not match the constraint.
The available widgets are:
Datum/Zeit: Stellt ein Linienfeld dar, das ein Kalender-Widget zum Öffnen eines Datums, einer Zeit oder beidem, darstellt. Der Spaltentyp muss Text sein. Sie könnne ein benutzerdefiniertes Format auswählen, einen Pop-up-Kalender, etc.
Versteckt: Ein verstecktes Attribut ist unsichtbar. Der Anwender kann den Inhalt nicht sehen.
Bereich: Erlaubt Ihnen numerische Werte eines bestimmten Wertebereichs festzulegen. Das Bearbeitungselement kann entweder ein Schieber oder ein Drehfeld sein.
Tipp
Relative Path in widgets
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. This is enabled only for File Name, Photo and Web View at this moment.
By default, when you click on a feature with the Identify Features tool or switch the attribute table to the form view mode, QGIS displays a form with tabulated textboxes (one per field). This rendering is the result of the default Autogenerate value of the Layer properties ‣ Fields ‣ Attribute editor layout setting. Thanks to the widget setting, you can improve this dialog.
You can furthermore define built-in forms (see figure_fields_form), e.g. when you have objects with many attributes, you can create an editor with several tabs and named groups to present the attribute fields.
Choose Drag and drop designer from the Attribute editor layout combobox to layout the features form within QGIS. Then, drag and drop rows from the Fields frame to the Label panel to have fields added to your custom form.
You can also use categories (tab or group frames) to better structure the form. The first step is to use the icon to create a tab in which fields and groups will be displayed (see figure_fields_layout). You can create as many categories as you want. The next step will be to assign to each category the relevant fields, using the icon. You’d need to select the targeted category beforehand. You can use the same fields many times.
You can configure tabs or groups with a double-click. QGIS opens a form in which you can:
With a double-click on a field label, you can also specify whether the label of its widget should be visible or not in the form.
In case the layer is involved in one to many relations (see Creating one or many to many relations), referencing layers are listed in the Relations frame and their form can be embedded in the current layer form by drag-and-drop. Like the other items, double-click the relation label to configure some options:
The Provide ui-file option allows you to use complex dialogs made with Qt-Designer. Using a UI-file allows a great deal of freedom in creating a dialog. Note that, in order to link the graphical objects (textbox, combobox...) to the layer’s fields, you need to give them the same name.
Use the Edit UI to define the path to the file to use.
You’ll find some example in the Creating a new form lesson of the QGIS Training Manual. For more advanced information, see http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/.
QGIS forms can have a Python function that is called when the dialog is opened. Use this function to add extra logic to your dialogs. The form code can be specified in three different ways:
In all cases you must enter the name of the function that will be called (open in the example below).
Ein Beispiel ist (im Modul MyForms.py):
def open(dialog,layer,feature):
geom = feature.geometry()
control = dialog.findChild(QWidged,"My line edit")
Reference in Python Init Function like so: open
The Joins tab allows you to join a loaded attribute table to a loaded vector layer. After clicking , the Add vector join dialog appears. As key columns, you have to define a join layer you want to connect with the target vector layer. Then, you have to specify the join field that is common to both the join layer and the target layer. Now you can also specify a subset of fields from the joined layer based on the checkbox Choose which fields are joined. As a result of the join, all information from the join layer and the target layer are displayed in the attribute table of the target layer as joined information. If you specified a subset of fields only these fields are displayed in the attribute table of the target layer.
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 (see figure_joins).
Zusätzlich können Sie mit dem Vektorverknüpfung hinzufügen Dialog:
Erstellen Sie einen :guilabel:`Benutzerdefinierten Feldnamen Präfix `
The Diagrams tab allows you to add a graphic overlay to a vector layer (see figure_diagrams_attributes).
Die aktuelle Kernimplementation von Diagrammen bietet Unterstützung von:
Tipp
Switch quickly between types of diagrams
Given that the settings are almost common to the different types of diagram, when designing your diagram, you can easily change the diagram type and check which one is more appropriate to your data without any loss.
For each type of diagram, the properties are divided into several tabs:
Attribute`definiert, welche Variablen in dem Diagramm gezeigt werden. Nutzen Sie den :sup:`Objekt hinzufügen Knopf um das gewünschte Feld in das ‘Zugeordnete Attribut’ Bedienfeld zu schieben. Erzeugte Attribute mit den Ausdrücke können auch genutzt werden.
You can move up and down any row with click and drag, sorting how attributes are displayed. You can also change the label in the ‘Legend’ column or the attribute color by double-clicking the item.
This label is the default text displayed in the legend of the print composer or of the layer tree.
Appearance defines how the diagram looks like. It provides general settings that do not interfere with the statistic values such as:
die Ausrichtung der linken Linie von der ersten Scheibe im Tortendiagramm. Beachten Sie, die Scheiben werden im Uhrzeigersinn angezeigt.
In this tab, you can also manage the diagram visibility:
Size is the main tab to set how the selected statistics are represented. The diagram size units can be ‘Map Units’ or ‘Millimeters’. You can use :
Feste Größe, eine feste Größe zum Darstellen der Grafik aller Objekte, außer beim Darstellen des Histogramms
oder Skalierte Größe, basiert auf einem Ausdruck, der Layerattribute benutzt.
Platzierung hilft die Diagramm Position einzustellen. Entsprechend dem Layergeometrietyp, bietet es verschiedene Optionen zur Platzierung:
‘Über dem Zentrum’, ‘Um das Zentrum’ (mit eingestellter Distanz), ‘Umfang’ und irgendwo ‘Innerhalb des Polygons’ sind die Optionen für Polygonobjekte.
The diagram can also be placed using feature data by filling the X and Y fields with an attribute of the feature.
The placement of the diagrams can interact with the labeling, so you can detect and solve position conflicts between diagrams and labels by setting the Priority slider or the z-index value.
Der Reiter Optionen hat nur Einstellungen im Fall eines Histrogramms. Sie können wählen, ob die Orientierung der Leiste ‘oben’, ‘unten’, ‘rechts’ und ‘links’ ist.
From the Legend tab, you can choose to display items of the diagram in the Layers Panel, besides the layer symbology. It can be:
When set, the diagram legend items are also available in the print composer legend, besides the layer symbology.
Wir werden ein Beispiel zeigen und dem Alaskagrenzlayer ein Textdiagramm das Temperaturdaten von einem climate Vektorlayer zeigt überlagern. Beide Vektorlayer sind Teil des QGIS Beispieldatensatzes (siehe Abschnitt Sample Data).
Klicken Sie erst auf das Vektorlayer hinzufügen Icon, browsen Sie zum QGIS Beispieldatensatzordner und laden Sie die beiden Vektorlayer alaska.shp und climate.shp.
Doppelklicken Sie auf den climate Layer in der Kartenlegende um den Dialog Layereigenschaften zu öffnen.
Im Darstellung Reiter wählen wir ein Hellblau als Hintergrundfarbe und im Reiter Größe stellen wir eine feste Größe von 18 mm ein.
Im Reiter Position könnte die Platzierung auf ‘Um Punkt’ eingestellt werden.
Im Diagramm wollen wir die Werte der drei Spalten T_F_JAN, T_F_JUL und T_F_MEAN darstellen. Wählen Sie erst T_F_JAN als Attribute´ und klicken Sie den |signPlus| Knopf, dann ``T_F_JUL` und schließlich T_F_MEAN.
Sie können die Diagrammgröße im Größe Reiter anpassen. Aktivieren Sie Skalierte Größe und stellen Sie die Größe des Diagramms auf Basis eines Attributes mit dem Maximalwert und dem Größe Menü ein. Wenn die Diagramme auf dem Bildschirm zu klein erscheinen können Sie das Kleine Diagramme vergrößern Kontrollkästchen aktivieren und die Minimalgröße des Diagramms definieren.
Behalten Sie im Hinterkopf dass im Reiter Position eine Datendefinierte Position der Diagramme möglich ist. Sie können hier Attribute verwenden um die Position des Diagramms zu definieren. Sie können auch eine maßstabsabhängige Sichtbarkeit im Darstellung Reiter einstellen.
The size and the attributes can also be an expression. Use the button to add an expression. See Ausdrücke chapter for more information and example.
As mentioned above, you can use some custom data-defined to tune the diagrams rendering:
See Datendefinierte Übersteuerung für das Beschriften for more information.
QGIS bietet die Möglichkeit, Aktionen auf Basis von Attributen einer Ebene durchzuführen. Dies kann für eine Vielzahl von Aktionen genutzt werden, z.B. um ein Programm mit Abfragen aus der Attributdatenbank zu füttern oder um Parameter an ein Web-Reporting-Tool weiterzugeben.
Aktionen auf Basis von Attributen sind sinnvoll wenn sie häufig eine externe Anwendung starten oder eine Internetseite auf Basis von einem oder mehreren Werten in Ihrem Vektorlayer visualisieren wollen. Sie sind in 6 Typen aufgeteilt und können wie folgt verwendet werden:
Allgemein, Mac, Windows und Unix Aktionen starten einen externen Prozess.
Python Aktionen führen einen Python-Ausdruck aus.
Allgemeine und Pythonaktionen sind überall sichtbar.
Mac, Windows und Unix Aktionen sind nur sichtbar auf der entsprechenden Plattform (z.B. können Sie drei ‘Bearbeiten’ Aktionen definieren um einen Editor zu öffnen und die Benutzer können nur die eine ‘Bearbeiten’ Aktion für Ihr Betriebssystem sehen und ausführen um den Editor zu starten).
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.
To define an attribute action, open the vector Layer Properties dialog and click on the Actions tab. In the Actions tab, click the Add a new action to open the Edit Action dialog.
Select the action Type and provide a descriptive name for the action. The action itself must contain the name of the application that will be executed when the action is invoked. You can add one or more attribute field values as arguments to the application. When the action is invoked, any set of characters that start with a % followed by the name of a field will be replaced by the value of that field. The special characters %% will be replaced by the value of the field that was selected from the identify results or attribute table (see using_actions below). Double quote marks can be used to group text into a single argument to the program, script or command. Double quotes will be ignored if preceded by a backslash.
Wenn Sie Feldnamen vorfinden die Substrings anderer Feldnamen sind (z.B., col1 und col10) sollten Sie das angeben indem Sie den Feldnamen (und den % Buchstaben) mit eckigen Klammern umrunden (z.B. [%col10]). Hiermit wird vermieden dass der %col10 Feldname mit de, %col1 Feldnamen mit einem 0 am Ende verwechselt wird. Die Klammern werden von QGS entfernt wenn es im Wert des Feldes ersetzt. Wenn Sie wollen dass das zu ersetzende Feld von eckigen Klammern umrandet wird verwenden Sie ein zweites Set wie hier:[[%col10]].
Wenn Sie das Objekte abfragen Werkzeug verwenden, können Sie den Identifikationsergebnis Dialog öffnen. Es enthält eine (Abgeleitet) Item das layertyprelevante Informationen enthält. Die Werte in diesem Element können auf ähnliche Weise den anderen Feldern zugeordnet werden indem dem Abgeleitet Feldnamen ein (Derived) vorangeht. Zum Beispiel hat ein Punktlayer ein X und Y Feld und die Werte dieser Felder können in der Aktion mit %(Derived).X und %(Derived).Y verwendet werden. Die Abgeleitet Attribute sind nur in der Objekte abfragen Dialog Box erhältlich, jedoch nicht in der Attributtabelle Dialogbox.
Two example actions are shown below:
In the first example, the web browser konqueror is invoked and passed a URL to open. The URL performs a Google search on the value of the nam field from our vector layer. Note that the application or script called by the action must be in the path, or you must provide the full path. To be certain, we could rewrite the first example as: /opt/kde3/bin/konqueror http://www.google.com/search?q=%nam. This will ensure that the konqueror application will be executed when the action is invoked.
Das zweite Beispiel nutzt den Ausdruck %%, welcher unabhängig ist von einem speziellen Feld. Beim Ausführen des Befehls wird der Ausdruck %% durch den Wert des jeweils selektierten Feldes aus Objekte abfragen oder der Attributtabelle ersetzt.
Actions can be invoked from either the Identify Results dialog, an Attribute Table dialog or from Run Feature Action (recall that these dialogs can be opened by clicking Identify Features or Open Attribute Table or Run Feature Action). To invoke an action, right click on the feature and choose the action from the pop-up menu (they should have been enabled to be displayed in the attribute table). Actions are listed in the popup menu by the name you assigned when defining the action. Click on the action you wish to invoke.
Wenn Sie eine Aktion mit %% Notation verwenden, machen Sie einen Rechtsklick auf den Feldwert im Objekte abfragen Dialog oder im Attributtabelle Dialog den Sie der Anwendung oder dem Skript übergeben wollen.
In einem weiteren Beispiel soll gezeigt werden, wie Attributwerte eines Vektorlayers abgefragt und in eine Textdatei mit Hilfe der Bash und des echo Kommandos geschrieben werden (funktioniert also nur unter und evtl. ). Der Abfragelayer enthält die Felder Art taxon_name, Latitude lat und Longitude long. Wir möchten jetzt eine räumliche Selektion von Örtlichkeiten machen und diese Feldwerte in eine Textdatei für den ausgewählten Datensatz (in der QGIS Kartenansicht in gelb gezeigt) exportieren. Hier ist die Aktion, um dies zu erreichen:
bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"
Nachdem ein paar Orte auf dem Bildschirm ausgewählt wurden (diese erscheinen gelb hinterlegt), starten wir die Aktion mit der rechten Maustaste über den Dialog Abfrageergebnisse und können danach in der Textdatei die Ergebnisse ansehen:
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 http://google.com/search?q=qgis, where QGIS is the search term. Armed with this information, we can proceed:
Laden Sie den Layer file:lakes.shp.
Öffnen Sie den Layereigenschaften Dialog indem Sie einen Doppelklick auf den Layer in der Legende machen und wählen Sie Eigenschaften aus dem Popup-Menü.
Click on the Actions tab.
Geben Sie einen Namen für die Aktion ein, z.B. Google Search.
Für diese Aktion ist es notwendig den Namen des externen Programms anzugeben. In diesem Fall können wir Firefox verwenden. Wenn das Programm sich nicht im Pfad befindet müssen Sie den vollständigen Pfad angeben.
Following the name of the external application, add the URL used for doing a Google search, up to but not including the search term: http://google.com/search?q=
The text in the Action field should now look like this: firefox http://google.com/search?q=
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.
From the drop-down box, select ‘NAMES’ and click [Insert].
Die Aktion sieht nun so aus:
firefox http://google.com/search?q=%NAMES
To finalize and add the action, click the [OK] button.
Damit ist die Aktion fertig für den Einsatz. Der gesamte Befehl der Aktion sollte folgendermaßen aussehen:
firefox http://google.com/search?q=%NAMES
Damit ist die Aktion fertig für den Einsatz. Schließen Sie den Eigenschaften Dialog und zoomen Sie in einen Bereich Ihrer Wahl. Stellen Sie sicher, dass der Layer lakes in der Legende aktiviert ist. Nun identifizieren Sie einen See. In der Ergebnisanzeige sollte nun die Aktion sichtbar sein:
When we click on the action, it brings up Firefox and navigates to the URL http://www.google.com/search?q=Tustumena. It is also possible to add further attribute fields to the action. Therefore, you can add a + to the end of the action text, select another field and click on [Insert Field]. In this example, there is just no other field available that would make sense to search for.
Sie können auch mehrere Aktionen für einen Layer definieren. Sie alle werden dann bei der Abfrage von Objekten im Identifikationsergebnis Dialog angezeigt.
Sie können auch die aus der Attributtabelle aufrufen, indem Sie eine Zeile mit der rechten Maustaste auswählen und dann die Aktion aus dem Pop-up-Menü wählen.
Sie sehen, man kann sich eine Vielzahl interessanter Aktionen ausdenken. Wenn Sie z.B. einen Punktlayer mit einzelnen Punkten haben, an denen Photos geschossen wurden, dann können Sie eine Aktion erstellen, über die Sie dann das entsprechende Foto anzeigen lassen können, wenn Sie auf den Punkt in der Karte klicken. Man kann auch zu bestimmten Attributen webbasierte Information ablegen (z.B. in einer HTML-Datei) und diese dann über eine Aktion anzeigen lassen, etwa so wie in dem Google Beispiel.
Wir können auch komplexere Beispiele erstellen, indem wir z.B. Python Aktionen verwenden.
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 a shapefile or SpatiaLite)? The following code will do the trick:
command = "firefox"
imagerelpath = "images_test/test_image.jpg"
layer = qgis.utils.iface.activeLayer()
import os.path
layerpath = layer.source() if layer.providerType() == 'ogr'
else (qgis.core.QgsDataSourceURI(layer.source()).database()
if layer.providerType() == 'spatialite' else None)
path = os.path.dirname(str(layerpath))
image = os.path.join(path,imagerelpath)
import subprocess
subprocess.Popen( [command, image ] )
Wir müssen uns nur ins Gedächtnis rufen dass es sich um eine Python Aktion handelt und dass das Ändern der command und imagerelpath Variablen auf unsere Bedürfnisse angepasst wird.
Was aber wenn der relative Pfad relativ zur (gespeicherten) Projektdatei sein muss? Der Code der Python Aktion würde wie folgt lauten:
command = "firefox"
imagerelpath = "images/test_image.jpg"
projectpath = qgis.core.QgsProject.instance().fileName()
import os.path
path = os.path.dirname(str(projectpath)) if projectpath != '' else None
image = os.path.join(path, imagerelpath)
import subprocess
subprocess.Popen( [command, image ] )
Ein anderes Python Aktion Beispiel ist das mit wir dem Projekt neue Layer hinzufügen können. Z.B. wird in den folgenden Beispielen dem Projekt ein Vektorlayer beziehungsweise ein Rasterlayer hinzugefügt. Die Namen der Dateien, die dem Projekt hinzugefügt werden sollen, und die Namen, die den Layern gegeben werden, sind datengesteuert (filename und layername sind Spaltennamen der Attributtabelle des Vektorlayers in dem die Aktion erstellt wurde):
qgis.utils.iface.addVectorLayer('/yourpath/[% "filename" %].shp',
'[% "layername" %]', 'ogr')
Um eine Rasterdatei hinzuzufügen (ein TIF-Bild in diesem Beispiel) wird daraus:
qgis.utils.iface.addRasterLayer('/yourpath/[% "filename" %].tif',
'[% "layername" %]')
This tab is specifically created for map tips: display a message in the map canvas when hovering over a feature of the active layer. This message can either be the value of a Field or a more complex and full HTML text mixing fields, expressions and html tags (multiline, fonts, images, hyperlink ...).
To activate Map Tips, select the menu option View ‣ Map Tips or click on the Map Tips icon. Map tip is a cross-session feature meaning that once activated, it stays on and apply to any set layer in any project, even in future QGIS sessions until it’s toggled off.
Figures Display Code and Mapped show an example of HTML code and how it behaves in map canvas.
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 Simplify geometry option. There is also a global setting that enables generalisation by default for newly added layers (see global simplification for more information).
Bemerkung
Objektgeneralisierung, kann in einigen Fällen, Artefakte in Ihre gerenderte Ausgabe einführen. Dies können Splitter zwischen Polygonen und ungenau Darstellung bei der Verwendung von Offset-basierten Symbolayern sein.
While rendering extremely detailed layers (e.g. polygon layers with a huge number of nodes), this can cause composer 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.
Aktivieren von Force layer to render as raster zwingt diese Layer dazu gerastert zu werden, so dass die exportierten Dateien nicht alle enthaltenen Knoten in diesen Layern enthalten müssen und die Wiedergabe daher beschleunigt wird.
You can also do this by forcing the composer to export as a raster, but that is an all-or-nothing solution, given that the rasterisation is applied to all layers.
The Metadata tab consists of Description, Attribution, MetadataURL, LegendUrl and Properties sections.
In the Properties section, you get general information about the layer, including specifics about the type and location, number of features, feature type, and editing capabilities. The Extents table provides you with information on the layer extent and the Layer Spatial Reference System, which is information about the CRS of the layer. This can provide a quick way to get useful information about the layer.
Additionally, you can add or edit a title and abstract for the layer in the Description section. It’s also possible to 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.
Use Attribution to get attribute data from an XML metadata catalog.
In MetadataUrl, you can define the general path to the XML metadata catalog. This information will be saved in the QGIS project file for subsequent sessions and will be used for QGIS server.
Im Abschnitt LegendenUrl, können Sie der URL eines Legendenbilds in dem URL Feld anbieten. Sie können das Format Drop-Down-Menü nutzen, um das entsprechende Format des Bilds anzuwenden. Zur Zeit werden png, jpg und jpeg Formate unterstützt.
Tipp
Wechseln Sie schnell zwischen verschiedenen Layerdarstellungen
Using the Styles ‣ Add combobox at the bottom of the Layer Properties dialog, you can save as many combinations of layer properties settings (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.
The Variables tab lists all the variables available at the layer’s level (which includes all global and project’s variables).
It also allows the user to manage layer-level variables. Click the button to add a new custom layer-level variable. Likewise, select a custom layer-level variable from the list and click the button to remove it.
More information on variables usage in the General Tools Variables section.
The Legend tab provides you with 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...).
By default, QGIS provides transparency widget but this can be extended by plugins registering their own widgets and assign custom actions to layers they manage.