Janela de Propriedades de Vetor

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 popup menu.

Figure Vector Properties 1:


Vector Layer Properties Dialog nix

Style Menu

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 and special symbolizing tools that were designed for the different kinds of vector data.

Layer rendering

  • Layer transparency slider: you can make the underlying layer in the map canvas visible with this tool. Use the slider to adapt the visibility of your vector layer to your needs. You can also make a precise definition of the percentage of visibility in the the menu beside the slider.
  • Layer blending mode: you can achieve special rendering effects with these tools that you 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: It 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 1 (in the case of RGB), white is displayed. This mode is suitable for highlighting features.
    • Darken: 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: It multiplies the numbers for each pixel of the top layer with the corresponding pixel for the bottom layer. The results are darker pictures.
    • Burn: Darker colors in the top layer causes the underlying layers to darken. Can be used to tweak and colorise underlying layers.
    • Overlay: Combines multiply and screen blending modes. In the resulting picture light parts of the picture become lighter and dark parts become darker.
    • Soft light: Very similar to overlay, but instead of using multiply/screen it uses color burn/dodge. This one is supposed to emulate shining a soft light onto an image.
    • Hard light: Hard light is 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 round, to always get a positive value. Blending with black produces no change, as values for all colors are 0.
    • Subtract: This blend mode simply subtracts pixel values of one layer with tshe other. In case of negative values, black is displayed.

Since QGIS 2.0 the old symbology is no longer available. In this version the new symbology has been redesigned and revised.


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


Seleção e mudança de simbolos multiplos

The Symbology allows to select multiple symbols and right click to change color, transparency, size, or width of selected entries.

Renderizando Simbolo Individual

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

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

Figure Symbology 1:


Single symbol line properties nix

More detailed settings can be made when clicking on the second level in the Symbol layers dialog. You can define Symbol layers that are combined afterwards. A symbol can consist of several Symbol layers. The following settings are possible:

  • Symbol layer type: You have the possibility to use Ellipse markers, Font markers, Simple markers, SVG markers and Vector Field markers
  • Size
  • Angle
  • Colors
  • Border width
  • Offset X,Y: You can shift the symbol in x- or y-direction

Note that once you have set the size in the lower levels the size of the whole symbol can be changed with the Size menu in the first level again. The size of the lower levels changes accordingly while the size ratio is maintained. After having done any needed changes, the symbol can be added to the list of current style symbols (using the [Symbol] selectstring Save in symbol library) and then 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). Currently in version 2.0 SLDs can be exported from any type of renderer: single symbol, categorized, graduated or rule-based, but when importing an SLD, either a single symbol or rule-based renderer is created. That means that categorized or graduated styles are converted to rule-based. If you want to preserve those renderers, you have to stick to the QML format. On the other hand, it could be very handy sometimes to have this easy way of converting styles to rule-based.

With the Style manager from the [Symbol] selectstring menu you can administrate your symbols. You can mActionSignPlus add item, editedit item, mActionSignMinus remove item and user share item. ‘Marker’ symbols, ‘Line’ symbols, ‘Fill’ patterns and ‘Color ramps’ can be used to create the symbols (see defining_symbols). The symbols are assigned to ‘All Symbols’, ‘Groups’ or ‘Smart groups’ then.

Renderizador Categorizado

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

  • O Atributo (Usando a coluna listagem)

  • Simbolo (usando a aba Simbolo)

  • As cores (usando rampa de cores lista box)

The [Advanced] button in the lower right corner of the dialog allows to set the fields containing rotation and size scale information. For convenience, the list in 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_2 shows the category rendering dialog used for the rivers layer of the QGIS sample dataset.

Figure Symbology 2:


Categorized Symbolizing options nix

You can create a custom color ramp choosing New color ramp... from the Color ramp dropdown menu. A dialog will prompt for the ramp type: Gradient, Random, ColorBrewer, and cpt-city. The first three have options for number of steps and/or multiple stops in the color ramp. See figure_symbology_3 for an example of custom color ramp and figure_symbology_3a for the cpt-city dialog.

Figure Symbology 3:


Example of custom gradient color ramp with multiple stops nix

The cpt-city option opens a new dialog with hundreds of themes included ‘out of the box’.

Figure Symbology 3a:


cpt-city dialog with hundreds of color ramps nix

Renderização Graduada

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

Figure Symbology 4:


Graduated Symbolizing options nix

Like Categorized Renderer, it allows to define rotation and size scale from specified columns.

Análogo a renderização categorizada, a :guilabel: aba Estilo permite que voce selecione:

  • O Atributo (Usando a coluna listagem)

  • O simbolo (usando o botão Propriedades do Simbolo)

  • As cores (usando a lista de rampas de cores)

Adicionalmente, voce pode especificar o numero de classes e também o modo como classificar os recursos dentro das classes (usando o Modo lista). Os modos disponíveis são:

  • Intervalo igual

  • Quartil

  • Quebras Naturais (Jenks)

  • Desvio padrão

  • Quebras suaves

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

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

Renderizador baseado em regras

O renderizador baseado em regras é utilizado para renderizar todas as feições de uma camada utilizando símbolos baseados em regras, cujas cores refletem a classificação do atributo de uma feição selecionada para uma classe. As regras são baseadas em declarações SQL. A janela permite agrupar as regras através de filtros e escala e você pode decidir se quer habilitar níveis de símbolos ou usar somente a primeira regra correspondente.

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

To create a rule, activate an existing row by clicking on it or click on ‘+’ and click on the new rule. Then press the [Edit rule] button. In the Rule properties dialog you can define a label for the rule. Press the browsebutton button to open the Expression builder. In the Function List, click on Fields and Values to view all attributes of the attribute table to be searched. To add an attribute to the Field calculator Expression field, double click its name in the Fields and Values list. Generally you can use the various fields, values and functions to construct the calculation expression or you can just type it into the box (see Calculadora de campo).

Figure Symbology 5:


Rule-based Symbolizing options nix

Deslocamento de ponto

O renderizador de deslocamento de ponto oferece a visualização de todas as feições de uma camada de pontos, mesmo se eles tem a mesma localização. Para para isso, os símbolos dos pontos são postos em um círculo de deslocamento ao redor de um símbolo.

Figure Symbology 6:


Point displacement dialog nix


Export vector symbology

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

Labels Menu

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

  • Text
  • Formatting
  • Buffer
  • Background
  • Shadow
  • Placement
  • Rendering

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

Rotulando camadas de pontos

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.

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.

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

You can define the text style in the Text menu (see Figure_labels_1 ). A new function is the Type case option where you can influence the text rendering. You have the possibility to render the text ‘All uppercase’, ‘All lowercase’ or ‘Capitalize first letter’. Also, a new function in QGIS 2.0 is the use of blend modes (see blend_modes).

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

To create a buffer just activate checkbox Draw text buffer checkbox in the Buffer menu. The buffer color is variable. Also, a new function in QGIS 2.0 is the use of blend modes (see blend_modes).

If the 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 the user to make outlined text.

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

Use the Shadow menu for a user-defined Drop shadow. The drawing of the background is very variable. Choose between ‘Lowest label component’, ‘Text’, ‘Buffer’ and ‘Background’. The Offset angle depends on the orientation of the label. If you choose the 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. 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 possibility to use Quadrants to place your label. Additionally you can alter the angle of the label placement with the Rotation setting. Thus, a placement in a certain quadrant with a certain rotation is possible.

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

Figure Labels 1:


Smart labeling of vector point layers nix

Rotulando camadas de linhas

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.

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

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

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

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

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

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

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

Figure Labels 2:


Smart labeling of vector line layers nix

Rotulando camadas de polígonos

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.

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

The Formatting menu allows you to format multiple lines like for point and line layers.

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

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

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

In the Placement menu you find special settings for polygon layers (see Figure_labels_3 ). 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 define if the centroid is 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 used for the whole polygon, no matter if you can see the whole feature on the map. You can place your label with the quadrants here and define offset and rotation. The 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 dependend position are possible.

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

Figure Labels 3:


Smart labeling of vector polygon layers nix

Using data-defined override for labeling

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

  1. Import the lakes.shp from the QGIS sample dataset.
  2. Double-klick the layer to open the Layer Properties. Klick on Labels and Placement. Select radiobuttonon Offset from centroid.
  3. Look for the Data defined entries. Klick 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. Zoom into a lake.
  5. Go to the Label toolbar and klick the mActionMoveLabel Icon. Now you can shift the label manually to another position (see figure_labels_5 ). The new position of the label is saved in the ‘xlabel’ and ‘ylabel’ columns of the attribute table.

Figure Labels 4:


Labeling of vector polygon layers with data-defined override nix

Figure Labels 5:


Move labels nix

Fields Menu

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 mActionToggleEditing Editing mode.

Edição de Widget

Figure Fields 1:


Dialog to select an edit widget for an attribute column nix

Within the Fields menu you also find an edit widget column. This column can be used to define values or a range of values that are allowed to be added to the specific attribute table column. If you click on the [edit widget] button, a dialog opens, where you can define different widgets. These widgets are:

  • ** Edição Linha **: um campo de edição que permite a inserção de texto simples (ou restritor para números de atributos numéricos).

  • Classification: Displays a combo box with the values used for classification, if you have chosen ‘unique value’ as legend type in the Style menu of the properties dialog.
  • Tamanho: Permite definir valores numéricos de um tamanho específico. A edição do Widget pode ser um controle deslizante ou uma caixa de rotação.

  • ** Valores únicoss **: O usuário pode selecionar um dos valores já utilizados na tabela de atributos. Se editável é ativado, uma linha de edição é mostrada com suporte para autocompletar, caso contrário, uma caixa de combinação é utilizada.

  • ** Nome do Arquivo **: Simplifica a seleção, adicionando uma janela de seleção de arquivos.

  • ** Mapa de Valor **: uma caixa de combinação com itens pré-definidos. O valor é armazenado no atributo, a descrição é mostrada na caixa de combinação. Você pode definir valores manualmente ou carregá-los a partir de uma camada ou um arquivo CSV.

  • ** Enumeração **: Abre uma caixa de combinação com valores que podem ser usados ​​dentro no tipo de colunas. Atualmente é suportado apenas por provedores de postgres.

  • ** Imutável **: A coluna de atributo imutável é somente leitura. O usuário não é habilitado para modificar o conteúdo.

  • ** oculto **: Uma coluna de atributo oculto é invisível. O usuário não é capaz de ver o seu conteúdo.

  • ** Caixa de seleção **: Exibe uma caixa de seleção e você pode definir qual atributo é adicionado na coluna quando a caixa de seleção é ativada ou não.

  • ** Edição de texto **: Isto abre um campo de edição de texto que permite que várias linhas sejam utilizadas.

  • ** Calendário **: Abre um widget de calendário para introduzir uma data. Tipo de coluna deve ser de texto.

  • Value Relation: Offers values from a related table in a combobox. You can select layer, key column and value column.
  • UUID Generator: Generates a read-only UUID (Universally Unique Identifiers) field, if empty.
  • Photo: Field contains a filename for a picture. The width and height of the field can be defined.
  • Webview: Field contains an URL. The width and height of the field is variable.
  • Color: A field which allows to enter color codes. During data entry the color is visible through a color bar included in the field.

With the Attribute editor layout you can now define builtin forms for data entry jobs (see figure_fields_2). Choose ‘Drag and drop designer’ and an attribute column. Use the mActionSignPlus Icon to create a category that then will be shown during the digitizing session (see figure_fields_3). Next step will be to assign the relevant fields to the category with the mActionArrowRight Icon. You can create more categories and use the same fields again. When creating a new category QGIS will insert a new tab for the category in the built in form.

Other options in the dialog are ‘Autogenerate’ and ‘Provide ui-file’. ‘Autogenerate’ just creates Editors for all fields and tabulates them. The ‘Provide ui-file’ option allows you to use complex dialogs made with the Qt-Designer. Using an UI-file allows a large freedom in creating a dialog. For detailed information see http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/ .

QGIS 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, .qgis2/python, or inside the project folder

Figure Fields 2:


Dialog to create categories with the Attribute editor layout

Figure Fields 3:


Resulting built in form in a data entry session

General Menu

general Use this menu to make general settings for the vector layer. There are several options available:

Layer Info

  • Change the display name of the layer in displayed as
  • Define the Layer source of the vector layer
  • Define the Data source encoding to define provider specific option and to be able to read the file

Coordinate Reference System

  • Specify the Coordinate Reference System. Here you can view or change the projection of the specific vector layer.
  • Create a Spatial Index (only for OGR supported formats)
  • Update Extents information for a layer
  • View or change the projection of the specific vector layer, clicking on Specify ...

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

Figure General 1:


General menu in vector layers properties dialog nix

Display Menu

mActionMapTips In QGIS 2.0 there is now an own menu for the map tips. It includes a new feature: Map Tip display text in HTML. While you can still choose a 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

Actions Menu

action QGIS fornece a capacidade de executar uma ação com base nos atributos de um recurso. Isso pode ser usado para executar qualquer número de ações, por exemplo, a execução de um programa com argumentos construídos a partir dos atributos de um recurso ou passar parâmetros ao uma ferramenta de comunicação web.

Figure Actions 1:


Overview action dialog with some sample actions nix

Actions are useful when you frequently want to run an external application or view a web page based on one or more values in your vector layer. They are devided into 6 types and can be used like this:

  • Generic, Mac, Windows and Unix actions start an external process,
  • Python actions execute a python expression,
  • Generic and Python actions are visible everywhere,
  • Mac, Windows and Unix actions are visible only on the respective platform (i.e. you can define three ‘Edit’ actions to open an editor and the users can only see and execute the one ‘Edit’ action for their platform to run the editor).

There are several examples included in the dialog. You can load them clicking on [Add default actions]. An example is performing a search based on an attribute value. This concept is used in the following discussion.

** Definição de Ações **

Attribute actions are defined from the vector Layer Properties dialog. To define an action, open the vector Layer Properties dialog and click on the Actions menu. Go to the Action properties. Select ‘Generic’ as type and provide a descriptive name for the action. The action itself must contain the name of the application that will be executed when the action is invoked. You can add one or more attribute field values as arguments to the application. When the action is invoked any set of characters that start with a % followed by the name of a field will be replaced by the value of that field. The special characters %% will be replaced by the value of the field that was selected from the identify results or attribute table (see using_actions below). Double quote marks can be used to group text into a single argument to the program, script or command. Double quotes will be ignored if preceded by a backslash.

Se você tem os nomes de campo que são substrings de outros nomes de campo (por exemplo,`` col1`` e col10 ), você deve indicar, cercando o nome do campo (e do %caráter) entre colchetes (por exemplo, [%col10] ). Isso impedirá que o campo com nome %Col10 seja confundido com o campo de nome %col1 com um 0 no final. Os suportes serão removidos por QGIS quando se substitui no valor do campo. Se você deseja que o campo substituído seja cercado por colchetes, utilizar um segundo conjunto da seguinte maneira: [[% Col10]].

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

Two example actions are shown below:

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

No primeiro exemplo o navegador Konqueror é acionado e passa a abrir uma URL. A URL executa uma pesquisa no Google sobre o valor do campo nam de nossa camada vetorial. Note que a aplicaçao ou script acionado pela ação deve estar no caminho ou você deve fornecer o caminho completo. Para ter certeza, poderíamos reescrever o primeiro exemplo como:`` / opt/kde3/bin/konqueror http://www.google.com/search?q =% nam``. Isto irá assegurar que a aplicação konqueror será executado quando a ação é invocado.

O segundo exemplo utiliza a notação % % que não depende de um campo específico para o seu valor. Quando a ação é invocada, o % % será substituído pelo valor do campo selecionado na identificação de resultados ou na tabela de atributos.

** Utilizando Ações **

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 popup menu. Actions are listed in the popup menu by the name you assigned when defining the actions. Click on the action you wish to invoke.

If you are invoking an action that uses the %% notation, right-click on the field value in the Identify Results dialog or the Attribute Table dialog that you wish to pass to the application or script.

Aqui está outro exemplo que puxa os dados de uma camada vetorial e os insere em um arquivo usando o bash e o comando``eco`` (por isso só vai funcionar no|nix| ou talvez no|osx|). A camada em questão tem campos para um nome da espécie taxon_name , latitude lat e longitude long . Eu gostaria de ser capaz de fazer uma seleção espacial das localidades e exportar esses campos de valores em um arquivo de texto para o registro selecionado (mostrado em amarelo na área do mapa do QGIS). Aqui é a ação para atingir este objectivo:

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

Depois de selecionar algumas localidades e executar a ação em cada um, a abertura do arquivo de saída irái mostrar algo como isto:

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

Como um exercício, criamos uma ação que faz uma pesquisa no Google sobre o a camada lagos. Primeiro, precisamos determinar o URL necessário para realizar uma pesquisa sobre a palavra-chave. Isso póde ser realizado facilmente indo ao Google e realizando uma pesquisa simples, em seguida, pegar a URL na barra de endereços do seu navegador. A partir deste pequeno esforço, vemos que o formato é: http://google.com/search?q=qgis , onde QGIS é o termo de pesquisa. Armado com esta informação, podemos prosseguir:

  1. Verifique se a camada lagos está carregada.

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

  3. Click on the Actions menu.

  4. Digite um nome para a ação, por exemplo `` Google Search ``.

  5. Para a ação, precisamos fornecer o nome do programa externo a ser executado. Neste caso, podemos usar o Firefox. Se o programa não estiver em seu caminho, você precisará fornecer o caminho completo.

  6. Seguindo o nome da aplicação externa, adicione a URL usada para fazer uma pesquisa no Google, mas não inclua o termo de busca: `` http://google.com/search?q=``

  7. O texto no campo de ação será mostrado como este: `` firefox http://google.com/search?q =``

  8. Click on the drop-down box containing the field names for the lakes layer. It’s located just to the left of the [Insert Field] button.

  9. From the drop-down box select ‘NAMES’ and click [Insert Field].

  10. Seu texto ação agora se parecerá como este:

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

  11. To finalize the action click the [Add to action list] button.

A ação é completada e está pronta para usar. O texto final da ação deve ser semelhante a este:

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

Agora podemos utilizar a ação. Feche a: aba de diálogo: ‘Propriedades da camada ` e aplique um zoom em uma área de interesse. Certifique-se que a camada lagos está ativa e identifique um lago. Na caixa o resultado que você poderá visualizar que a nossa ação está visível:

Figure Actions 2:


Select feature and choose action nix

Quando clicamos sobre a ação, ela faz o Firefox e navegar para o URL http://www.google.com/search?q=Tustumena. Também é possível adicionar outros campos de atributo para essa açao. Para isso basta um + ao final do texto de ação, selecionar outro campo e clicar em [Inserir Campo). Nesse exemplo não temos outro campo disponível para efetuarmos a busca.

Você pode definir múltiplas ações para uma camada e cada uma vai aparecer na caixa de diálogo: guilabel: Identificar resultados.

Você pode pensar em todos os tipos de usos para as ações. Por exemplo, se você tem uma camada de pontos que contém as localizações de imagens ou fotos, juntamente com um nome de arquivo, você pode criar uma ação para lançar um visualizador para exibir a imagem. Você também pode usar ações para lançar relatórios baseados na web para um campo de atributo ou combinação de campos, especificando-as da mesma forma que fizemos no nosso exemplo de busca Google.

Nós também podemos fazer exemplos mais complexos, por exemplo, sobre como usar ações em ** Python **.

Normalmente, quando nós criamos uma ação para abrir um arquivo com uma aplicação externa, podemos usar caminhos absolutos, ou, eventualmente, caminhos relativos, no segundo caso, o caminho é relativo ao local do arquivo executável do programa externo. Mas quando, precisamos usar caminhos relativos, em relação à camada selecionada (um arquivo com base um, como um shapefile ou SpatiaLite)? O código a seguir irá fazer o truque:

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

Temos que basta lembrar que a ação é um dos tipo * Python * e pode ser modificada as variáveis no * comando * e * imagerelpath * ​​para atender as necessidades.

Mas o que dizer se o caminho relativo precisa ser relativo ao arquivo de projeto (salvo)? O código da ação Python seria:

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

Outro exemplo de ações usando Python nos permite adicionar novas camadas ao projeto. O exemplo a seguir,por exemplo, irá adicionar ao projeto um vetor e raster , respectivamente,. O nome dos arquivos a serem adicionados ao projeto e o nome a ser dado à camada são controlados aos dados(filename e layname são o nome das colunas da tabela de atributo do vetor onde a ação será criada):

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

Para adicionar um raster (uma imagem tif, neste exemplo) utiliza-se:

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

Joins Menu

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 , a join field that corresponds to an attribute column in the target layer and a target field you find in the attribute table of the target vector layer here. As a result, all information of the join layer and the target layer are displayed in the attribute table of the target layer as joined information.

QGIS currently supports to join 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

Adicionalmente, o adicionar ligação de vetor permite:

  • checkbox Cache join layer in virtual memory
  • checkbox Create attribute index on the join field

Diagrams Menu

diagram The Diagrams menu allows you to add a graphic overlay to a vector layer (see figure_diagrams_1).

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

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

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

Figure Diagrams 1:


Vector properties dialog with diagram menu nix

We will demonstrate an example and overlay the alaska boundary layer a text diagram showing some temperature data from a climate vector layer. Both vector layers are part of the QGIS sample dataset (see Section Sample Data).

  1. Primeiro clique no ícone | mActionAddOgrLayer |: Adicionar Camada Vetorial , procure nos exemplos da pasta conjunto de dados de amostra e carregue as duas camadas de arquivo vetorial: arquivo: alaska.shp e: arquivo: climate.shp.

  2. Dê um clique duplo na camada clima na legenda do mapa para abrir a aba de diálogo ‘Propriedades da camada `.

  3. Click on the Diagrams menu, activate checkboxDisplay diagrams and from Diagram type selectstring combobox select ‘Text diagram’
  4. In the Appearance tab we choose a light blue as Background color and in the Size tab we set a fixed size to 18 mm.
  5. In the Position tab Placement could be set to AroundPoint.
  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 now 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 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 impression.
  10. Finalmente, clique em [Ok].

Figure Diagrams 2:


Diagram from temperature data overlayed on a map nix

Remember that in the Position tab a checkbox Data defined position of the diagrams is possible. Here you can use attributes to define the position of the diagram. Also, a scale dependent visibility that you can find in the Appearance tab is possible.

Metadata Menu

metadata The Metadata menu consists of a Description, Attribution, MetadataURL and Properties section.

In the Properties section you get general information about the layer, including specifics about the type and location, number of features, feature type, and the editing capabilities in the Properties section. The Extents table provides you with layer extent information, and the Layer Spatial Reference System information, providing information about the CRS of the layer. This is a quick way to get information about the layer.

Additionally you can add/edit a title for the layer and some abstract information in the Description. Also, it’s possible to define a Keyword list here. These keyword lists can be used in a metadata catalogue. If you want to use a title from an XML metadata file you have to fill in a link in the DataUrl field. Use Attribution to get Atrribute data from an XML metadata catalogue. In MetadataUrl you can define the general path to the XML metadata catalogue. These information will be saved in the QGIS project file for following sessions and will be used for QGIS server.

Figure Metadata 1:


Metadata menu in vector layers properties dialog nix