Outdated version of the documentation. Find the latest one here.


Fenêtre Propriétés d’une couche vecteur

The Layer Properties dialog for a vector layer provides information about the layer, symbology settings and labeling options. If your vector layer has been loaded from a PostgreSQL/PostGIS datastore, you can also alter the underlying SQL for the layer by invoking the Query Builder dialog on the General tab. 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.

Figure Vector Properties 1:


Vector Layer Properties Dialog nix

Onglet Style

The Style menu provides you with a comprehensive tool for rendering and symbolizing your vector data. You can use Layer rendering ‣ tools that are common to all vector data, as well as special symbolizing tools that were designed for the different kinds of vector data.


The renderer is responsible for drawing a feature together with the correct symbol. There are four types of renderers: single symbol, categorized, graduated and rule-based. There is no continuous color renderer, because it is in fact only a special case of the graduated renderer. The categorized and graduated renderers can be created by specifying a symbol and a color ramp - they will set the colors for symbols appropriately. For point layers, there is a point displacement renderer available. For each data type (points, lines and polygons), vector symbol layer types are available. Depending on the chosen renderer, the Style menu provides different additional sections. On the bottom right of the symbology dialog, there is a [Symbol] button, which gives access to the Style Manager (see Presentation). The Style Manager allows you to edit and remove existing symbols and add new ones.

After having made any needed changes, the symbol can be added to the list of current style symbols (using [Symbol] selectstring Save in symbol library), and then it can easily be used in the future. Furthermore, you can use the [Save Style] selectstring button to save the symbol as a QGIS layer style file (.qml) or SLD file (.sld). SLDs can be exported from any type of renderer – single symbol, categorized, graduated or rule-based – but when importing an SLD, either a single symbol or rule-based renderer is created. That means that categorized or graduated styles are converted to rule-based. If you want to preserve those renderers, you have to stick to the QML format. On the other hand, it can be very handy sometimes to have this easy way of converting styles to rule-based.

Si, en travaillant sur le style d’une couche vectorielle, vous changez de mode de rendu, les changements effectués sur le symbole sont mémorisés. Notez que cela ne fonctionne qu’une seule fois. Si vous changez à nouveau de mode de rendu, les paramètres seront perdus.

If the datasource of the layer is a database (PostGIS or Spatialite for example), you can save your layer style inside a table of the database. Just click on Save Style comboxbox and choose Save in database item then fill in the dialog to define a style name, add a description, an ui file and if the style is a default style. When loading a layer from the database, if a style already exists for this layer, QGIS will load the layer and its style. You can add several style in the database. Only one will be the default style anyway.

Figure Vector Properties 2:


Save Style in database Dialog nix


Sélectionner et modifier plusieurs symboles

Il est possible de sélectionner plusieurs symboles, de faire un clic-droit dessus et de changer en une seule opération leur couleur, leur transparence, leur taille ou leur épaisseur.

Single Symbol Renderer

The Single Symbol Renderer is used to render all features of the layer using a single user-defined symbol. The properties, which can be adjusted in the Style menu, depend partially on the type of layer, but all types share the following dialog structure. In the top-left part of the menu, there is a preview of the current symbol to be rendered. On the right part of the menu, there is a list of symbols already defined for the current style, prepared to be used by selecting them from the list. The current symbol can be modified using the menu on the right side.

If you click on the first level in the Symbol layers dialog on the left side, it’s possible to define basic parameters like Size, Transparency, color and Rotation. Here, the layers are joined together.

Figure Symbology 3:


Single symbol line properties nix

In any spinbox in this dialog you can enter expressions. E.g. you can calculate simple math like multiplying the existing size of a point by 3 without resorting to a calculator.

Figure Symbology 4:


Expression in Size spinbox nix

If you click on the second level in the Symbol layers dialog a ‘Data-defined override’ for nearly all settings is possible. When using a data-defined color one may want to link the color to a field ‘budged’. Here a comment functionality is inserted.

/* This expression will return a color code depending on the field value.
 * Negative value: red
 * 0 value: yellow
 * Positive value: green
  WHEN value < 0 THEN '#DC143C' -- Negative value: red
  WHEN value = 0 THEN '#CCCC00' -- Value 0: yellow
  ELSE '#228B22'                -- Positive value: green

Figure Symbology 5:


Data-defined symbol with Edit... menu

Categorized Renderer

The Categorized Renderer is used to render all features from a layer, using a single user-defined symbol whose color reflects the value of a selected feature’s attribute. The Style menu allows you to select:

  • The attribute (using the Column listbox or the mActionmIconExpressionEditorOpen Set column expression function, see Expressions)
  • The symbol (using the Symbol dialog)
  • The colors (using the color Ramp listbox)

Then click on Classify button to create classes from the distinct value of the attribute column. Each classes can be disabled unchecking the checkbox at the left of the class name.

You can change symbol, value and/or label of the class, just double click on the item you want to change.

Un clic-droit vous propose de Copier / Coller, Modifier la couleur, Modifier la transparence, Modifier l’unité de sortie ou Modifier la taille.

The [Advanced] button in the lower-right corner of the dialog allows you to set the fields containing rotation and size scale information. For convenience, the center of the menu lists the values of all currently selected attributes together, including the symbols that will be rendered.

The example in figure_symbology_6 shows the category rendering dialog used for the rivers layer of the QGIS sample dataset.

Figure Symbology 6:


Categorized Symbolizing options nix

Graduated Renderer

The Graduated Renderer is used to render all the features from a layer, using a single user-defined symbol whose color reflects the assignment of a selected feature’s attribute to a class.

Figure Symbology 7:


Graduated Symbolizing options nix

Like the Categorized Renderer, the Graduated Renderer allows you to define rotation and size scale from specified columns.

Also, analogous to the Categorized Renderer, the Style tab allows you to select:

  • The attribute (using the Column listbox or the mActionmIconExpressionEditorOpen Set column expression function, see Expressions chapter)
  • The symbol (using the Symbol Properties button)
  • The colors (using the color Ramp list)

Additionally, you can specify the number of classes and also the mode for classifying features within the classes (using the Mode list). The available modes are:

  • Intervalles égaux : toutes les classes sont de même taille (par exemple, avec des valeurs allant de 0 à 16 et 4 classes, chaque classe aura une taille de 4);

  • Quantile : toutes les classes auront le même effectif (même principe que pour les boîtes à moustache);

  • Ruptures naturelles (Jenks) : la variance de chaque classe est minimale tandis que la variance entre les différentes classes est maximale;

  • Écart-type : les classes sont construites en fonction le l’écart-type calculé sur l’ensemble des valeurs;

  • Pretty Breaks: the same of natural breaks but the extremes number of each class are integers.

La zone de liste dans la partie centrale du menu Style répertorie les classes ainsi que leurs étendues, étiquettes et symboles de rendu.

Click on Classify button to create classes using the choosen mode. Each classes can be disabled unchecking the checkbox at the left of the class name.

You can change symbol, value and/or label of the clic, just double clicking on the item you want to change.

Un clic-droit vous propose de Copier / Coller, Modifier la couleur, Modifier la transparence, Modifier l’unité de sortie ou Modifier la taille.

The example in figure_symbology_7 shows the graduated rendering dialog for the rivers layer of the QGIS sample dataset.


Cartes thématiques utilisant une expression

Categorized and graduated thematic maps can now be created using the result of an expression. In the properties dialog for vector layers, the attribute chooser has been augmented with a mActionmIconExpressionEditorOpen Set column expression function. So now you no longer 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.

Rule-based rendering

The Rule-based Renderer is used to render all the features from a layer, using rule based symbols whose color 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.

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

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 browsebutton 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 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 Expressions). 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 match. Since QGIS 2.8 the rules appear in a tree hierarchy in the map legend. Just double-klick the rules in the map legend and the Style menu of the layer properties appears showing the rule that is the background for the symbol in the tree.

Figure Symbology 8:


Rule-based Symbolizing options nix

Point displacement

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 a center symbol.

Figure Symbology 9:


Point displacement dialog nix


Exporter le style d’une couche vecteur

You have the option to export vector symbology from QGIS into Google *.kml, *.dxf and MapInfo *.tab files. Just open the right mouse menu of the layer and click on Save selection as ‣ to specify the name of the output file and its format. In the dialog, use the Symbology export menu to save the symbology either as Feature symbology ‣ or as Symbol layer symbology ‣. If you have used symbol layers, it is recommended to use the second setting.

Inverted Polygon

Inverted polygon renderer allows user to define a symbol to fill in outside of the layer’s polygons. As before you can select subrenderers. These subrenderers are the same as for the main renderers.

Figure Symbology 10:


Inverted Polygon dialog nix


Switch quickly between styles

Once you created one of the above mentioned styles you can right-klick on the layer and choose Styles ‣ Add to save your style. Now you can easily switch between styles you created using the Styles ‣ menu again.


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 a color ramp for the heatmap style and use a slider for selecting a tradeoff between render speed and quality. When adding or removing a feature the heatmap renderer updates the heatmap style automatically.

Color Picker

Regardless the type of style to be used, the select color dialog will show when you click to choose a color - either border or fill color. This dialog has four different tabs which allow you to select colors by mIconColorBox color ramp, mIconColorWheel color wheel, mIconColorSwatches color swatches or mIconColorPicker color picker.

Whatever method you use, the selected color is always described through color sliders for HSV (Hue, Saturation, Value) and RGB (Red, Green, Blue) values. There is also an opacity slider to set transparency level. On the lower left part of the dialog you can see a comparison between the current and the new color you are presently selecting and on the lower right part you have the option to add the color you just tweaked into a color slot button.

Figure color picker 1:


Color picker ramp tab nix

With mIconColorBox color ramp or with mIconColorWheel color wheel, you can browse to all possible color combinations. There are other possibilities though. By using color swatches mIconColorSwatches you can choose from a preselected list. This selected list is populated with one of three methods: Recent colors, Standard colors or Project colors

Figure color picker 2:


Color picker swatcher tab nix

Another option is to use the mIconColorPicker color picker which allows you to sample a color from under your mouse pointer at any part of QGIS or even from another application by pressing the space bar. Please note that the color picker is OS dependent and is currently not supported by OSX.


quick color picker + copy/paste colors

You can quickly choose from Recent colors, from Standard colors or simply copy or paste a color by clicking the drop-down arrow that follows a current color box.

Figure color picker 3:


Quick color picker menu nix

Rendu de couche

  • Transparence de la couche slider : permet de rendre visible les couches situées en dessous. Utiliser le curseur pour adapter la visibilité de la couche vectorielle à vos besoins. Vous pouvez également définir directement le pourcentage de transparence dans la zone de texte située à côté.

  • 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 below.
    • Normal: This is the standard blend mode, which uses the alpha channel of the top pixel to blend with the pixel beneath it. The colors aren’t mixed.
    • Lighten: This selects the maximum of each component from the foreground and background pixels. Be aware that the results tend to be jagged and harsh.
    • Screen: Light pixels from the source are painted over the destination, while dark pixels are not. This mode is most useful for mixing the texture of one layer with another layer (e.g., you can use a hillshade to texture another layer).
    • Dodge: Dodge will brighten and saturate underlying pixels based on the lightness of the top pixel. So, brighter top pixels cause the saturation and brightness of the underlying pixels to increase. This works best if the top pixels aren’t too bright; otherwise the effect is too extreme.
    • Addition: This blend mode simply adds pixel values of one layer with the other. In case of values above one (in the case of RGB), white is displayed. This mode is suitable for highlighting features.
    • Darken: This creates a resultant pixel that retains the smallest components of the foreground and background pixels. Like lighten, the results tend to be jagged and harsh.
    • Multiply: Here, the numbers for each pixel of the top layer are multiplied with the corresponding pixels for the bottom layer. The results are darker pictures.
    • Burn: Darker colors in the top layer cause the underlying layers to darken. Burn can be used to tweak and colorise underlying layers.
    • Overlay: This mode combines the multiply and screen blending modes. In the resulting picture, light parts become lighter and dark parts become darker.
    • Soft light: This is very similar to overlay, but instead of using multiply/screen it uses color burn/dodge. This is supposed to emulate shining a soft light onto an image.
    • Hard light: Hard light is also very similar to the overlay mode. It’s supposed to emulate projecting a very intense light onto an image.
    • Difference: Difference subtracts the top pixel from the bottom pixel, or the other way around, to always get a positive value. Blending with black produces no change, as the difference with all colors is zero.
    • Subtract: This blend mode simply subtracts pixel values of one layer from the other. In case of negative values, black is displayed.

Onglet Étiquettes

The mActionLabeling Labels core application provides smart labeling for vector point, line and polygon layers, and it only requires a few parameters. This new application also supports on-the-fly transformed layers. The core functions of the application have been redesigned. In QGIS, there are a number of other features that improve the labeling. The following menus have been created for labeling the vector layers:

  • Texte

  • Formatage

  • Tampon

  • Fond

  • Ombre

  • Emplacement

  • Rendu

Let us see how the new menus can be used for various vector layers.

Labeling point layers

Start QGIS and load a vector point layer. Activate the layer in the legend and click on the mActionLabeling Layer Labeling Options icon in the QGIS toolbar menu.

The first step is to activate the checkbox Label this layer with checkbox and select an attribute column to use for labeling. Click mActionmIconExpressionEditorOpen if you want to define labels based on expressions - See labeling_with_expressions.

The following steps describe a simple labeling without using the Data defined override functions, which are situated next to the drop-down menus.

You can define the text style in the Text menu (see Figure_labels_1 ). Use the Type case option to influence the text rendering. You have the possibility to render the text ‘All uppercase’, ‘All lowercase’ or ‘Capitalize first letter’. Use the blend modes to create effects known from graphics programs (see blend_modes).

In the Formatting menu, you can define a character for a line break in the labels with the ‘Wrap on character’ function. Use the checkbox Formatted numbers option to format the numbers in an attribute table. Here, decimal places may be inserted. If you enable this option, three decimal places are initially set by default.

To create a buffer, just activate the checkbox Draw text buffer checkbox in the Buffer menu. The buffer color is variable. Here, you can also use blend modes (see blend_modes).

If the checkbox color buffer’s fill checkbox is activated, it will interact with partially transparent text and give mixed color transparency results. Turning off the buffer fill fixes that issue (except where the interior aspect of the buffer’s stroke intersects with the text’s fill) and also allows you to make outlined text.

In the Background menu, you can define with Size X and Size Y the shape of your background. Use Size type to insert an additional ‘Buffer’ into your background. The buffer size is set by default here. The background then consists of the buffer plus the background in Size X and Size Y. You can set a Rotation where you can choose between ‘Sync with label’, ‘Offset of label’ and ‘Fixed’. Using ‘Offset of label’ and ‘Fixed’, you can rotate the background. Define an Offset X,Y with X and Y values, and the background will be shifted. When applying Radius X,Y, the background gets rounded corners. Again, it is possible to mix the background with the underlying layers in the map canvas using the Blend mode (see blend_modes).

Use the Shadow menu for a user-defined Drop shadow. The drawing of the background is very variable. Choose between ‘Lowest label component’, ‘Text’, ‘Buffer’ and ‘Background’. The Offset angle depends on the orientation of the label. If you choose the checkbox 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 (see blend_modes).

Choose the Placement menu for the label placement and the labeling priority. Using the radiobuttonon Offset from point setting, you now have the option to use Quadrants to place your label. Additionally, you can alter the angle of the label placement with the Rotation setting. Thus, a placement in a certain quadrant with a certain rotation is possible. In the priority section you can define with which priority the labels are rendered. It interacts with labels of the other vector layers in the map canvas. If there are labels from different layers in the same location then the label with the higher priority will be displayed and the other will be left out.

In the Rendering menu, you can define label and feature options. Under Label options, you find the scale-based visibility setting now. You can prevent QGIS from rendering only selected labels with the checkbox Show all labels for this layer (including colliding labels) checkbox. Under Feature options, you can define whether every part of a multipart feature is to be labeled. It’s possible to define whether the number of features to be labeled is limited and to checkbox Discourage labels from covering features.

Figure Labels 1:


Smart labeling of vector point layers nix

Labeling line layers

The first step is to activate the checkbox Label this layer checkbox in the Label settings tab and select an attribute column to use for labeling. Click mActionmIconExpressionEditorOpen if you want to define labels based on expressions - See labeling_with_expressions.

After that, you can define the text style in the Text menu. Here, you can use the same settings as for point layers.

Also, in the Formatting menu, the same settings as for point layers are possible.

The Buffer menu has the same functions as described in section labeling_point_layers.

The Background menu has the same entries as described in section labeling_point_layers.

Also, the Shadow menu has the same entries as described in section labeling_point_layers.

In the Placement menu, you find special settings for line layers. The label can be placed radiobuttonon Parallel, radiobuttonoff Curved or radiobuttonoff Horizontal. With the radiobuttonon Parallel and radiobuttonoff Curved option, you can define the position checkbox Above line, checkbox On line and checkbox Below line. It’s possible to select several options at once. In that case, QGIS will look for the optimal position of the label. Remember that here you can also use the line orientation for the position of the label. Additionally, you can define a Maximum angle between curved characters when selecting the radiobuttonoff Curved option (see Figure_labels_2 ).

You can set up a minimum distance for repeating labels. Distance can be in mm or in map units.

Some Placement setup will display more options, for example, Curved and Parallel Placements will allow the user to set up the position of the label (above, below or on the line), distance from the line and for Curved, the user can also setup inside/outside max angle between curved label. As for point vector layers you have the possibility to define a Priority for the labels.

The Rendering menu has nearly the same entries as for point layers. In the Feature options, you can now Suppress labeling of features smaller than.

Figure Labels 2:


Smart labeling of vector line layers nix

Labeling polygon layers

The first step is to activate the checkbox Label this layer checkbox and select an attribute column to use for labeling. Click mActionmIconExpressionEditorOpen if you want to define labels based on expressions - See labeling_with_expressions.

In the Text menu, define the text style. The entries are the same as for point and line layers.

The Formatting menu allows you to format multiple lines, also similar to the cases of point and line layers.

As with point and line layers, you can create a text buffer in the Buffer menu.

Use the Background menu to create a complex user-defined background for the polygon layer. You can use the menu also as with the point and line layers.

The entries in the Shadow menu are the same as for point and line layers.

In the Placement menu, you find special settings for polygon layers (see Figure_labels_3). radiobuttonon Offset from centroid, radiobuttonoff Horizontal (slow), radiobuttonoff Around centroid, radiobuttonoff Free and radiobuttonoff Using perimeter are possible.

In the radiobuttonon Offset from centroid settings, you can specify if the centroid is of the radiobuttonon visible polygon or radiobuttonoff 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 with the quadrants here, and define offset and rotation. The radiobuttonoff Around centroid setting makes it possible to place the label around the centroid with a certain distance. Again, you can define radiobuttonon visible polygon or radiobuttonoff whole polygon for the centroid. With the radiobuttonoff Using perimeter settings, you can define a position and a distance for the label. For the position, checkbox Above line, checkbox On line, checkbox Below line and checkbox Line orientation dependent position are possible.

Related to the choice of Label Placement, several options will appear. As for Point Placement you can choose the distance for the polygon outline, repeat the label around the polygon perimeter.

As for point and line vector layers you have the possibility to define a Priority for the polygon vector layer.

The entries in the Rendering menu are the same as for line layers. You can also use Suppress labeling of features smaller than in the Feature options.

Figure Labels 3:


Smart labeling of vector polygon layers nix

Define labels based on expressions

QGIS allows to use expressions to label features. Just click the mActionmIconExpressionEditorOpen icon in the mActionLabeling Labels menu of the properties dialog. In figure_labels_4 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.

Figure Labels 4:


Using expressions for labeling nix

Expression based labeling is easy to work with. All you have to take care of is, that you need to combine all elements (strings, fields and functions) with a string concatenation sign ‘||’ and that fields a written in “double quotes” and strings in ‘single quotes’. Let’s have a look at some examples:

 # label based on two fields 'name' and 'place' with a comma as separater
 "name" || ', ' || "place"

 -> John Smith, Paris

 # label based on two fields 'name' and 'place' separated by comma
 'My name is ' || "name" || 'and I live in ' || "place"

 -> My name is John Smith and I live in Paris

 # label based on two fields 'name' and 'place' with a descriptive text
 # and a line break (\n)
 'My name is ' || "name" || '\nI live in ' || "place"

 -> My name is John Smith
    I live in Paris

 # create a multi-line label based on a field and the $area function
 # to show the place name and its area size based on unit meter.
 'The area of ' || "place" || 'has a size of ' || $area || 'm²'

 -> The area of Paris has a size of 105000000 m²

 # create a CASE ELSE condition. If the population value in field
 # population is <= 50000 it is a town, otherwise a city.
 'This place is a ' || CASE WHEN "population <= 50000" THEN 'town' ELSE 'city' END

-> This place is a town

Comme vous pouvez le constater dans le constructeur d’expressions, vous avez à votre disposition une centaine de fonctions pour créer des expressions simples ou très complexes afin d’étiqueter vos données avec QGIS. Voir Expressions pour plus d’informations et des exemples d’expressions.

Using data-defined override for labeling

With the data-defined override functions, the settings for the labeling are overridden by entries in the attribute table. You can activate and deactivate the function with the right-mouse button. Hover over the symbol and you see the information about the data-defined override, including the current definition field. We now describe an example using the data-defined override function for the mActionMoveLabelMove label function (see figure_labels_5 ).

  1. Import lakes.shp from the QGIS sample dataset.
  2. Double-click the layer to open the Layer Properties. Click on Labels and Placement. Select radiobuttonon Offset from centroid.
  3. Look for the Data defined entries. Click the mIconDataDefine icon to define the field type for the Coordinate. Choose ‘xlabel’ for X and ‘ylabel’ for Y. The icons are now highlighted in yellow.
  4. Zoomez sur un lac.

  5. Go to the Label toolbar and click the mActionMoveLabel icon. Now you can shift the label manually to another position (see figure_labels_6 ). The new position of the label is saved in the ‘xlabel’ and ‘ylabel’ columns of the attribute table.

Figure Labels 5:


Labeling of vector polygon layers with data-defined override nix

Figure Labels 6:


Move labels nix

Onglet Champs

attributes Within the Fields menu, the field attributes of the selected dataset can be manipulated. The buttons mActionNewAttribute New Column and mActionDeleteAttribute Delete Column can be used when the dataset is in mActionToggleEditing Editing mode.

Outils d’édition

Figure Fields 1:


Dialog to select an edit widget for an attribute column nix

Dans le menu Champs se trouve également une colonne Outil d’édition. Cette colonne peut être utilisée pour définir des valeurs ou des plages de valeurs à utiliser pour ce champ précis de la table attributaire. Si vous cliquez sur [Outil d’édition], il s’ouvre une fenêtre de dialogue dans laquelle vous pouvez définir différentes modalités. Celles-ci sont :

  • Boîte à cocher : Affiche une case à cocher et vous pouvez définir quelle valeur stocker quand la case est cochée ou pas.

  • Classification : Affiche une liste déroulante avec les valeurs utilisées pour la classification, si vous avez choisi le style ‘Catégorisé’ dans l’onglet Style de la fenêtre de propriétés.

  • Couleur : Affiche un bouton de couleur permettant de choisir une couleur via la fenêtre Sélectionner une couleur.

  • Date/Heure : Affiche un champ de type date/heure qui peut ouvrir un calendrier permettant de choisir une date, une heure ou les deux. Le champ doit être de type texte. Vous pouvez choisir un format personnalisé, l’affichage d’un calendrier, etc.

  • Énumération : Ouvre une liste déroulante avec les valeurs qui peuvent être utilisées selon la définition du type de champ. Ce mode d’édition n’est actuellement disponible que pour les couches PostgreSQL.

  • Nom de fichier : Simplifie la sélection d’un fichier par l’ouverture d’un explorateur de fichiers.

  • Cachée : Un attribut caché sera invisible. L’utilisateur ne pourra pas visualiser son contenu.

  • Photo : Champ contenant le nom d’un fichier de photo. La largeur et la hauteur peuvent être précisées.

  • Plage : Vous permet de spécifier une plage de valeurs numériques disponibles. Il peut s’agir d’une barre coulissante ou d’une zone de texte éditable.

  • Relation Reference: This widged lets you embed the feature form of the referenced layer on the feature form of the actual layer. See Creating one to many relations.
  • Édition de texte (par défait) : Ceci permet l’édition d’un texte simple ou multi-ligne. Si vous choisissez Multi-ligne, vous pouvez spécifier s’il s’agit d’un contenu en HTML.

  • Valeurs uniques : Vous pouvez sélectionner l’une des valeurs déjà utilisées dans cette colonne. Une ligne est affichée avec le support de l’auto-complétion si la case ‘Éditable’ est cochée, une boîte de saisie est utilisée sinon.

  • Générateur d’UUID : Champ en lecture seule qui génère un UUID (Identifiant Unique Universel) lorsqu’il est vide.

  • Liste de valeurs : Une liste déroulante avec des valeurs prédéfinies. La valeur est stockée dans l’attribut, la description est affichée dans la liste. Vous pouvez définir des valeurs manuellement ou les charger depuis la couche ou depuis un fichier CSV.

  • Value Relation: Offers values from a related table in a combobox. You can select layer, key column and value column.
  • Vue web : Champ contenant une URL. La largeur et la hauteur sont variables.


QGIS has an advanced ‘hidden’ option to define your own field widget using python and add it to this impressive list of widgets. It is tricky but it is very well explained in following excellent blog that explains how to create a real time validation widget that can be used like described widgets. See http://blog.vitu.ch/10142013-1847/write-your-own-qgis-form-elements

With the Attribute editor layout, you can now define built-in forms (see figure_fields_2). This is usefull for data entry jobs or to identify objects using the option auto open form 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’ and an attribute column. Use the mActionSignPlus icon to create a category to insert a tab or a named group (see figure_fields_3). When creating a new category, QGIS will insert a new tab or named group for the category in the built-in form. The next step will be to assign the relevant fields to a selected category with the mActionArrowRight icon. You can create more categories and use the same fields again.

Other options in the dialog are ‘Autogenerate’ and ‘Provide ui-file’.

QGIS dialogs can have a Python function that is called when the dialog is opened. Use this function to add extra logic to your dialogs. An example is (in module MyForms.py):

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

Reference in Python Init Function like so: MyForms.open

MyForms.py must live on PYTHONPATH, in .qgis2/python, or inside the project folder.

Figure Fields 2:


Fenêtre de création de catégories avec la Mise en page de l’éditeur d’attribut

Figure Fields 3:


Formulaire intégré obtenu avec onglets et groupes nommés

Onglet Général

general Utilisez cet onglet pour définir les paramètres généraux de la couche vecteur. Plusieurs options sont disponibles :

Informations sur la couche

  • Changez le nom affiché de la couche dans Nom de la couche

  • Définissez le fichier Source de la couche vectorielle

  • Définissez l’Encodage de la source des données pour spécifier le type d’encodage utilisé dans les données source et pour pouvoir les lire correctement

Système de Coordonnées de Référence

  • Sélectionner le SCR, système de coordonnées de référence. Ici vous pouvez visualiser ou modifier le SCR de la couche.

  • Créer un index spatial (uniquement pour les formats gérés par OGR),

  • Mettre à jour l’emprise dans les informations de la couche,

  • Voir ou modifier la projection de la couche vecteur en cliquant sur Sélectionner le SCR

checkbox Scale dependent visibility

  • You can set the Maximum (inclusive) and Minimum (exclusive) scale. The scale can also be set by the [Current] buttons.

Feature subset

  • With the [Query Builder] button, you can create a subset of the features in the layer that will be visualized (also refer to section Constructeur de requête).

Figure General 1:


General menu in vector layers properties dialog nix

Onglet Rendu

QGIS 2.2 introduces 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 new global setting that enables generalisation by default for newly added layers (see section Options). Note: Feature generalisation may introduce artefacts into your rendered output in some cases. These may include slivers between polygons and inaccurate rendering when using offset-based symbol layers.

Onglet Infobulles

mActionMapTips This menu is specifically created for Map Tips. It includes a new feature: Map Tip display text in HTML. While you can still choose a radiobuttonoff Field to be displayed when hovering over a feature on the map, it is now possible to insert HTML code that creates a complex display when hovering over a feature. To activate Map Tips, select the menu option View ‣ MapTips. Figure Display 1 shows an example of HTML code.

Figure Display 1:


HTML code for map tip nix

Figure Display 2:


Map tip made with HTML code nix

Onglet Actions

action QGIS provides the ability to perform an action based on the attributes of a feature. This can be used to perform any number of actions, for example, running a program with arguments built from the attributes of a feature or passing parameters to a web reporting tool.

Figure Actions 1:


Overview action dialog with some sample actions nix

Les actions sont utiles si vous voulez exécuter fréquemment une application externe ou charger une page web basée sur une ou plusieurs valeurs de votre couche vecteur. Il en existe six types qui peuvent être utilisés de la sorte :

  • Les actions de type Générique, Mac, Windows et Unix lancent un processus externe.

  • Les actions Python lancent un code Python.

  • Les actions de type Générique et Python sont disponibles quel que soit le système d’exploitation.

  • Les actions Mac, Windows et Unix sont disponibles uniquement depuis les systèmes d’exploitation correspondants (c’est à dire que vous pouvez définir trois actions ‘Éditer’ qui ouvrent un éditeur et les utilisateurs ne verront que l’action correspondant à leur système d’exploitation).

Quelques exemples d’actions sont fournis. Vous pouvez les charger en cliquant sur [Ajouter les actions par défaut]. Un des exemples effectue une recherche basée sur la valeur d’un attribut. C’est ce qui est développé par la suite.

Defining Actions

Les actions sur les attributs sont définies depuis la fenêtre Propriétés de la couche vecteur. Pour définir une action, ouvrez la fenêtre Propriétés de la couche vecteur et cliquez sur le menu Actions. Allez à Propriétés de l’action. Sélectionnez le type ‘Générique’ et fournissez un nom d’identification à l’action. Le texte de l’action doit lui-même contenir le nom de l’application qui sera exécutée lorsque l’action est invoquée. Vous pouvez ajouter un ou plusieurs champs en arguments pour l’application. Lorsque l’action est invoquée, tout jeu de caractères commençant par % suivi d’un champ sera remplacé par la valeur de ce champ. Les caractères spéciaux %% sont remplacés par la valeur du champ sélectionné dans la fenêtre Identifier les résultats ou dans la Table attributaire ( voir using_actions ci-après). Les guillemets double peuvent être utilisés pour regrouper le texte dans un argument unique pour l’application, le script ou le programme. Ils sont ignorés lorsque précédés d’un antislash.

If you have field names that are substrings of other field names (e.g., col1 and col10), you should indicate that by surrounding the field name (and the % character) with square brackets (e.g., [%col10]). This will prevent the %col10 field name from being mistaken for the %col1 field name with a 0 on the end. The brackets will be removed by QGIS when it substitutes in the value of the field. If you want the substituted field to be surrounded by square brackets, use a second set like this: [[%col10]].

Using the Identify Features tool, you can open the Identify Results dialog. It includes a (Derived) item that contains information relevant to the layer type. The values in this item can be accessed in a similar way to the other fields by preceeding the derived field name with (Derived).. For example, a point layer has an X and Y field, and the values of these fields can be used in the action with %(Derived).X and %(Derived).Y. The derived attributes are only available from the Identify Results dialog box, not the Attribute Table dialog box.

Deux exemples d’action sont proposés ci-dessous :

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

Dans le premier exemple, le navigateur internet konqueror est lancé avec une URL. L’URL effectue une recherche Google sur la valeur du champ nam de la couche vecteur. Notez que l’application ou le script appelé par l’action doit être dans le path sinon vous devez fournir le chemin complet vers l’application. Pour être certain, nous pouvons réécrire le premier exemple de cette manière : /opt/kde3/bin/konqueror http://www.google.com/search?q=%nam. Ceci assurera que l’application konqueror sera exécutée quand l’action sera invoquée.

Le deuxième exemple utilise la notation %% dont la valeur ne dépend pas d’un champ en particulier. Quand l’action est invoquée, %% sera remplacé par la valeur du champ sélectionné dans les résultats de l’identification ou dans la table d’attributs.

Using Actions

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 mActionIdentify Identify Features or mActionOpenTable Open Attribute Table or mAction Run Feature Action). To invoke an action, right click on the record and choose the action from the pop-up menu. Actions are listed in the popup menu by the name you assigned when defining the action. Click on the action you wish to invoke.

Si vous faites appel à une action qui utilise la notation %%, faites un clic droit sur la valeur du champ que vous souhaitez passer à l’application ou au script, dans la fenêtre Identifier les résultats ou dans la Table attributaire.

Here is another example that pulls data out of a vector layer and inserts it into a file using bash and the echo command (so it will only work on nix or perhaps osx). The layer in question has fields for a species name taxon_name, latitude lat and longitude long. We would like to be able to make a spatial selection of localities and export these field values to a text file for the selected record (shown in yellow in the QGIS map area). Here is the action to achieve this:

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

Après avoir sélectionné quelques localités et lancé l’action sur chacune d’entre elles, le fichier de destination ressemblera à ceci :

Acacia mearnsii -34.0800000000 150.0800000000
Acacia mearnsii -34.9000000000 150.1200000000
Acacia mearnsii -35.2200000000 149.9300000000
Acacia mearnsii -32.2700000000 150.4100000000

Comme exercice, nous allons créer une action qui réalise une recherche Google sur la couche lakes. Tout d’abord, nous avons besoin de déterminer l’URL nécessaire pour effectuer une recherche sur un mot clé. Il suffit simplement d’aller sur Google et faire une recherche simple puis récupérer l’URL dans la barre d’adresse de votre navigateur. De cela, nous en déduisons la formulation : http://google.com/search?q=qgis, où qgis est le terme recherché. À partir de tout cela, nous pouvons poursuivre :

  1. Assurez-vous que la couche lakes est chargée.

  2. Open the Layer Properties dialog by double-clicking on the layer in the legend, or right-click and choose Properties from the pop-up menu.

  3. Cliquez sur l’onglet Actions

  4. Entrez un nom pour l’action, par exemple Recherche Google.

  5. Pour l’action, nous devons fournir le nom du programme externe à lancer. Dans ce cas, nous allons utiliser Firefox. Si le programme n’est pas dans votre path, vous devez fournir le chemin complet.

  6. A la suite du nom de l’application externe, ajoutez l’URL utilisée pour faire la recherche Google, jusqu’au terme de recherche, mais sans l’ajouter : http://google.com/search?q=

  7. Le texte dans le champ Action devrait ressembler à ceci : firefox http://google.com/search?q=

  8. Cliquez sur le menu déroulant contenant les noms des champs pour la couche lakes. Il est situé juste à gauche du bouton [Insérer un champ].

  9. Sélectionnez le champ ‘NAMES’ du menu déroulant et cliquez sur [Insérer un champ].

  10. Votre texte Action ressemble maintenant à :

    firefox http://google.com/search?q=%NAMES

  11. Pour finaliser l’action, cliquez sur le bouton [Ajouter l’action à la liste].

L’action est donc entièrement définie et prête à être utilisée. Le texte final de l’action devrait correspondre à ça :

firefox http://google.com/search?q=%NAMES

Nous pouvons maintenant utiliser l’action. Fermez la fenêtre Propriétés de la couche et zoomez sur une zone d’intérêt. Assurez-vous que la couche lakes est active puis identifiez un lac. Dans la fenêtre de résultats, vous constatez que notre action est maintenant visible :

Figure Actions 2:


Select feature and choose action nix

Quand vous cliquez sur l’action, cela ouvre Firefox et charge l’URL http://www.google.com/search?q=Tustumena. Il est également possible d’ajouter d’autres champs attributs à l’action. Pour faire cela, vous pouvez ajouter un + à la fin du texte de l’action, sélectionnez un autre champ et cliquez sur [Insérer un champ]. Dans cet exemple, la recherche sur un autre champ n’aurait pas de sens.

Vous pouvez définir de multiples actions pour une couche et chacune apparaitra dans la fenêtre Identifier les résultats.

Vous pouvez imaginer toutes sortes d’utilisations pour ces actions. Par exemple, si vous avez une couche de points contenant la localisation d’images ou de photos ainsi qu’un nom de fichier, vous pouvez créer une action qui lancera un visualiseur pour afficher les images. Vous pouvez également utiliser les actions pour lancer des rapports sur internet pour un champ attributaire ou une combinaison de champs, en les spécifiant de la même manière que dans l’exemple d’une recherche Google.

Nous pouvons également fournir des exemples plus complexes, notamment sur la manière d’utiliser des actions Python.

D’ordinaire, lorsque l’on crée une action pour ouvrir un fichier avec une application externe, on peut utiliser un chemin absolu ou relatif. Dans ce dernier cas, le chemin dépend donc de l’emplacement du fichier d’exécution du programme externe. Mais si nous souhaitons utiliser des chemins relatifs à la couche sélectionnée (stockée sous forme de fichier comme un shapefile ou une base SpatiaLite) ? Le code suivant permet de le faire :

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 ] );

Il faut simplement se rappeler qu’il s’agit d’une action Python et qu’il faut modifier les variables command et imagerelpath selon vos besoins.

Et si le chemin relatif doit dépendre du fichier de projet (sauvegardé) ? Le code de l’action Python deviendra :

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 ] );

Un autre exemple d’action Python consiste à ajouter de nouvelles couche au projet. L’exemple qui suit montre comment ajouter une couche vecteur et un raster. Les noms des fichiers à ajouter au projet et les noms à donner aux couches dépendent de données attributaires (filename et layername sont deux champs de la table attributaire de la couche sur laquelle l’action est créée) :

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

Pour ajouter un raster (ici une image TIF), cela devient :

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

Onglet Jointures

join The Joins menu allows you to join a loaded attribute table to a loaded vector layer. After clicking mActionSignPlus, 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 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_1).

Figure Joins 1:


Join an attribute table to an existing vector layer nix

De plus, la fenêtre de jointure vous permet de :

  • checkbox Mettre la couche jointe en cache dans la mémoire virtuelle

  • checkbox Créer un index des attributs joins

  • checkbox Choisir les champs à joindre

  • checkbox Personnaliser le préfixe du champ

Onglet Diagrammes

diagram L’onglet Diagrammes permet d’ajouter une couche de graphiques sur une couche vecteur (voir figure_diagrams_1).

The current core implementation of diagrams provides support for pie charts, text diagrams and histograms.

The menu is divided into four tabs: Appearance, Size, Postion and Options.

In the cases of the text diagram and pie chart, text values of different data columns are displayed one below the other with a circle or a box and dividers. In the Size tab, diagram size is based on a fixed size or on linear scaling according to a classification attribute. The placement of the diagrams, which is done in the Position tab, interacts with the new labeling, so position conflicts between diagrams and labels are detected and solved. In addition, chart positions can be fixed manually.

Figure Diagrams 1:


Vector properties dialog with diagram menu nix

We will demonstrate an example and overlay on the Alaska boundary layer a text diagram showing temperature data from a climate vector layer. Both vector layers are part of the QGIS sample dataset (see section Échantillon de données).

  1. First, click on the mActionAddOgrLayer Load Vector icon, browse to the QGIS sample dataset folder, and load the two vector shape layers alaska.shp and climate.shp.
  2. Double-cliquez sur la couche climate dans la légende pour ouvrir la fenêtre de Propriétés de la Couche.

  3. Click on the Diagrams menu, activate checkboxDisplay diagrams, and from the Diagram type selectstring combo box, select ‘Text diagram’.
  4. Dans l’onglet Apparence, nous choisissons le bleu clair comme couleur de fond et définissons une taille fixe de 18 mm dans l’onglet Taille.

  5. Dans l’onglet Position, l’emplacement défini est Autour du point.

  6. In the diagram, we want to display the values of the three columns T_F_JAN, T_F_JUL and T_F_MEAN. First select T_F_JAN as Attributes and click the mActionSignPlus button, then T_F_JUL, and finally T_F_MEAN.
  7. Now click [Apply] to display the diagram in the QGIS main window.
  8. You can adapt the chart size in the Size tab. Deactivate the checkbox Fixed size and set the size of the diagrams on the basis of an attribute with the [Find maximum value] button and the Size menu. If the diagrams appear too small on the screen, you can activate the checkbox Increase size of small diagrams checkbox and define the minimum size of the diagrams.
  9. Change the attribute colors by double clicking on the color values in the Assigned attributes field. Figure_diagrams_2 gives an idea of the result.
  10. Cliquez enfin sur [OK].

Figure Diagrams 2:


Diagram from temperature data overlayed on a map nix

N’oubliez pas que, dans l’onglet Position, en cochant la case checkbox Source de définition de la position, vous pouvez utiliser des valeurs d’attributs pour choisir l’emplacement des diagrammes. Par ailleurs, dans l’onglet Apparence, vous pouvez définir la visibilité en fonction de l’échelle.

The size and the attributes can also be an expression. Use the mActionmIconExpressionEditorOpen button to add an expression. See Expressions chapter for more information and example.

Onglet Métadonnées

metadata The Metadata menu consists of Description, Attribution, MetadataURL 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 layer extent information and the Layer Spatial Reference System, which is information about the CRS of the layer. This is a quick way to get 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 catalogue. If you want to use a title from an XML metadata file, you have to fill in a link in the DataUrl field. Use Attribution to get attribute data from an XML metadata catalogue. In MetadataUrl, you can define the general path to the XML metadata catalogue. This information will be saved in the QGIS project file for subsequent sessions and will be used for QGIS server.

Figure Metadata 1:


Metadata menu in vector layers properties dialog nix