El Dialogo de las Propiedades del Vector

El cuadro de diálogo Propiedades de la capa para una capa vectorial proporciona una configuración general para administrar la apariencia de los elementos de la capa en el mapa (simbología, etiquetas, diagramas), interacción con el mouse (acciones, textos de aviso del mapa, diseño de formularios). También proporciona información de la capa.

Para acceder al diálogo Propiedades de capa:

  • En el panel Capas , doble-click en la capa o click-derecho y selecciona Propiedades… en el menú emergente;

  • Vaya al menú Capa ‣ Propiedades de capa… cuando la capa este seleccionada.

El diálogo vectorial Propiedades de capa proporciona las siguientes secciones:

metadata Information

system Source

symbology Symbology[1]

labeling Etiquetas[1]

diagram Diagramas

3d 3D View[1]

sourceFields Fields

formView Attributes Form

join Joins

auxiliaryStorage Auxiliary Storage

action Actions

display Visualización

rendering Renderizando

expression Variables

editMetadata Metadata

dependencies Dependencies

legend Leyenda

overlay QGIS Server

digitizing Digitizing

External plugins[2] tabs

[1] Also available in the Layer styling panel

[2] :ref:`External plugins ` opcionalmente, puede agregar pestañas a este cuadro de diálogo. Los que no se presentan en este documento. Consulte su documentación.

Truco

Comparta propiedades completas o parciales de los estilos de capa

El menú Style en la parte inferior del cuadro de diálogo le permite importar o exportar estas o parte de estas propiedades desde / hacia varios destinos (archivo, portapapeles, base de datos). Ver Managing Custom Styles.

Nota

Debido a que las propiedades (simbología, etiqueta, acciones, valores predeterminados, formas …) de capas incrustadas (ver Anidar proyectos) se extraen del archivo del proyecto original y para evitar cambios que puedan romper este comportamiento, el diálogo de propiedades de capa no está disponible para estas capas.

Propiedades de información

metadata La pestaña Information es de solo lectura y representa un lugar interesante para obtener rápidamente información resumida y metadatos en la capa actual. La información proporcionada es:

  • basado en el proveedor de la capa (formato de almacenamiento, ruta, tipo de geometría, codificación de fuente de datos, extensión …);

  • obtenida de filled metadata (acceso, links, contactos, historial…);

  • o relacionado con su geometría (extensión espacial, CRS …) o sus atributos (número de campos, características de cada …).

Propiedades de fuente

system Use esta pestaña para definir configuraciones generales para la capa vectorial.

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

Pestaña fuente en el diálogo de propiedades de capa vectorial

Aparte de establecer el nombre de capa para mostrar en Panel de capas, las opciones disponibles incluyen:

Sistema de coordenadas de referencia

  • Muestra Coordinate Reference System (CRS) ` de la capa. Puede cambiar el CRS de la capa, seleccionando uno usado recientemente en la lista desplegable o haciendo clic en el botón |setProjection|:sup:`Select CRS (ver Coordinate Reference System Selector). Utilice este proceso solo si el CRS aplicado a la capa es incorrecto o si no se aplicó ninguno. Si desea reproyectar sus datos en otro CRS, utilice algoritmos de reproyección de capa de Processing o Save it into another layer.

  • Crear índice espacial (solo para los formator OGR soportados).

  • Actualizar extensión información para una capa.

Constructor de Consulta

El diálogo Constructor de consultas es accesible a través del botón del epónimo en la parte inferior de la pestaña Fuente en el diálogo de Propiedades de Capa, Debajo del grupo Filtro de funciones del proveedor.

El generador de consultas proporciona una interfaz que le permite definir un subconjunto de las características de la capa utilizando una cláusula WHERE similar a SQL y mostrar el resultado en la ventana principal. Mientras la consulta esté activa, solo las características correspondientes a su resultado estarán disponibles en el proyecto.

Puede usar uno o más atributos de capa para definir el filtro en el `` Generador de consultas “”. El uso de más de un atributo se muestra en Figure_vector_querybuilder. En el ejemplo, el filtro combina los atributos.

  • toa (DateTime campo: cast("toa" as character) > '2017-05-17' y``cast(«toa» as character) < “2019-12-24T18:00:00”``),

  • name (String campo: "name" > 'S') y

  • FID (Integer campo: FID > 10)

utilizando los operadores y paréntesis AND, OR y NOT. Esta sintaxis (incluido el formato DateTime para el campo toa) funciona para los conjuntos de datos GeoPackage.

El filtro se realiza a nivel del proveedor de datos (OGR, PostgreSQL, MSSQL …). Por lo tanto, la sintaxis depende del proveedor de datos (DateTime, por ejemplo, no es compatible con el formato ESRI Shapefile). La expresión completa

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

Constructor de Consulta

También puede abrir el diálogo Constructor de Consulta usando la opción Filtro… desde el menú Layer o el menú contextual de la capa. Las secciones Campos, Valores y Operadores en el cuadro de diálogo le ayuda a construir la consulta tipo SQL expuesta en el cuadro Proveedor de expresión de filtrado específico.

La lista Campos contiene todos los campos de la capa. Para agregar una columna de atributos al campo de la cláusula WHERE de SQL, haga doble clic en su nombre o simplemente escríbalo en el cuadro SQL.

El cuadro Valores enumera los valores del campo seleccionado actualmente. Para enumerar todos los valores únicos de un campo, haga clic en el botón: guilabel:Todos. Para enumerar los primeros 25 valores únicos de la columna, haga clic en el botón: guilabel: Muestra. Para agregar un valor al campo de la cláusula WHERE de SQL, haga doble clic en su nombre en la lista Valores. Puede usar el cuadro de búsqueda en la parte superior del marco de Valores para navegar fácilmente y encontrar valores de atributos en la lista.

La sección Operadores contiene todos los operadores utilizables. Para agregar un operador al campo de la cláusula SQL WHERE, haga clic en el botón correspondiente. Operadores relacionales (`` = , ``> ``, ...), operador de comparación de cadenas ( LIKE``) y operadores lógicos (`` AND``, `` OR``, … ) están disponibles.

El botón Prueba le ayuda a verificar su consulta y muestra un cuadro de mensaje con el número de características que satisfacen la consulta actual. Use el botón Limpiar para borrar la consulta SQL y revertir la capa a su estado original (es decir, cargar completamente todas las entidades).

Cuando se aplica un filtro, QGIS trata el subconjunto resultante como si fuera la capa completa. Por ejemplo, si aplicó el filtro anterior para “Borough” (`` «TYPE_2» = “Borough”), no puede mostrar, consultar, guardar o editar `` Anchorage, porque ese es un “Municipio’y por lo tanto, no forma parte del subconjunto.

Truco

Las capas filtradas se indican en el Panel de capas

En el panel Capas, la capa filtrada se muestra con un icono indicatorFilterFiltro al lado que indica la consulta utilizada cuando el mouse se desplaza sobre el botón. Haga doble clic en el icono para abrir el diálogo Constructor de Consulta para edición.

Propiedades de simbología

symbology La pestaña Simbología le proporciona una herramienta integral para representar y simbolizar sus datos vectoriales. Puede usar herramientas que son comunes a todos los datos vectoriales, así como herramientas especiales de simbolización que fueron diseñadas para los diferentes tipos de datos vectoriales. Sin embargo, todos los tipos comparten la siguiente estructura de diálogo: en la parte superior, tiene un widget que lo ayuda a preparar la clasificación y el símbolo que se usará para las entidades y en la parte inferior el widget Reproducción de capas.

Truco

Cambia rápidamente entre diferentes representaciones de capa

Usando el menú Styles ‣ Add en la parte inferrior del diálogo Layer Properties, Puede guardar tantos estilos como sea necesario. Un estilo es la combinación de todas las propiedades de una capa (como simbología, etiquetado, diagrama, forma de campos, acciones …) como desee. Luego, simplemente cambie entre estilos desde el menú contextual de la capa en Panel de capas para obtener diferentes representaciones de sus datos automaticamente.

Truco

Exportar simbología vectorial

Tiene la opción de exportar simbología vectorial de QGIS a Google *.kml, *.dxf y archivos MapInfo *.tab. Simplemente abra el menú derecho del mouse de la capa y haga clic en Save As… para especificar el nombre del archivo de salida y su formato. En el cuadro de diálogo, use el menú Symbology export para guardar la simbología ya sea como Feature symbology ‣ o como Symbol layer symbology ‣. Si ha usado capas de símbolos, se recomienda usar la segunda configuración.

Representación de elementos

El renderizador es responsable de dibujar una entidad junto con el símbolo correcto. Independientemente del tipo de geometría de capa, hay cuatro tipos comunes de renderizadores: símbolo único, categorizado, graduado y basado en reglas. Para las capas de puntos, hay disponibles un desplazamiento de puntos y un renderizador de mapa de calor, mientras que las capas de polígono también se pueden renderizar con los polígonos invertidos y los renderizadores 2.5 D.

No hay un renderizador de color continuo, porque de hecho es solo un caso especial del renderizador graduado. Los renderizadores categorizados y graduados se pueden crear especificando un símbolo y una rampa de color; establecerán los colores para los símbolos de manera adecuada. Para cada tipo de datos (puntos, líneas y polígonos), hay disponibles tipos de capas de símbolos vectoriales. Dependiendo del renderizador elegido, el diálogo proporciona diferentes secciones adicionales.

Nota

Si cambia el tipo de renderizador al establecer el estilo de una capa vectorial, se mantendrá la configuración que realizó para el símbolo. Tenga en cuenta que este procedimiento solo funciona para un cambio. Si repite el cambio del tipo de renderizador, la configuración del símbolo se perderá.

Representador de Símbolo Único

El renderizador de singleSymbol Símbolo único se usa para representar todas las entidades de la capa usando un solo símbolo definido por el usuario. Ver The Symbol Selector para más información sobre la representación de símbolos.

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

Propiedades de línea con símbolo único

Sin representación de símbolos

El renderizador nullSymbolSin Símbolos es un caso de uso especial del renderizador Símbolo Único ya que aplica el mismo renderizado a todas las entidades. Con este renderizador, no se dibujará ningún símbolo para las entidades, pero se seguirán mostrando etiquetas, diagramas y otras partes que no sean símbolos.

Todavía se pueden hacer selecciones en la capa en el lienzo y las entidades seleccionadas se representarán con un símbolo predeterminado. También se mostrarán las entidades que se están editando.

Esto pretende ser un atajo útil para capas para las que solo desea mostrar etiquetas o diagramas, y evita la necesidad de representar símbolos con un relleno / borde totalmente transparente para lograr esto.

Representador Categorizado

El representador categorizedSymbol Categorizado se usa para representar las entidades de una capa, usando un símbolo definido por el usuario cuyo aspecto refleja los valores discretos de un campo o una expresión.

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

Opciones de simbolización categorizadas

Para usar la simbología categorizada para una capa:

  1. Seleccione el Value de clasificación: Puede ser un campo existente o una expression puede escribir en el cuadro o construir usando el botón asociado expression. El uso de expresiones para categorizar evita la necesidad de crear un campo ad hoc para fines de simbología (por ejemplo, si sus criterios de clasificación se derivan de uno o más atributos).

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

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

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

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

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

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

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

    Truco

    Si bien puede usar cualquier tipo de expresión para categorizar características, para algunas expresiones complejas puede ser más sencillo de usar rule-based rendering.

  2. Comfigure el Symbol, que se usará como símbolo base para todas las clases;

  3. Indique el Color ramp, es decir, el rango de colores de los cuales se selecciona el color aplicado a cada símbolo.

    Además de las opciones comunes de la color ramp widget, puede aplicar una unchecked Random Color Ramp a las categorías. Puede clickar en la entrada Shuffle Random Colors para regenerar un nuevo conjunto de colores aleatorios si no está satisfecho.

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

  5. Apply los cambios ie la live update no está en uso y cada entidad en el lienzo del mapa se representará con el símbolo de su clase.

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

Further tweaks can be done to the default classification:

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

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

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

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

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

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

  • Change Color… of the selected symbol(s)

  • Change Opacity… of the selected symbol(s)

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

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

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

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

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

    Truco

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

  • Unmerge Categories that were previously merged

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

  • Match to saved symbols: Usando la symbols library, asigna a cada categoría un símbolo cuyo nombre representa el valor de clasificación de la categoría

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

  • Symbol levels… para definir el orden de representación de símbolos.

Truco

Edit categories directly from the Layers panel

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

  • toggleAllLayers Toggle items visibility

  • showAllLayers Show all items

  • hideAllLayers Hide all items

  • Modify the symbol color thanks to the color selector wheel

  • Edit symbol… from the symbol selector dialog

  • Copy symbol

  • Paste symbol

Representador Graduado

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

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

Also, analogous to the Categorized Renderer, it allows you to select:

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

  • The symbol (using the Symbol selector dialog)

  • El formato de leyenda y la precisión

  • El método a usar para cambiar el símbolo: color o tamaño

  • The colors (using the color Ramp list) if the color method is selected

  • The size (using the size domain and its unit)

Then you can use the Histogram tab which shows an interactive histogram of the values from the assigned field or expression. Class breaks can be moved or added using the histogram widget.

Nota

Puede usar el panel Resumen estadístico para obtener más información sobre su capa vectorial. Ver Panel de resumen estadístico.

Back to the Classes tab, 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:

  • Equal Interval: each class has the same size (e.g. values from 0 to 16 and 4 classes, each class has a size of 4).

  • Quantile: each class will have the same number of element inside (the idea of a boxplot).

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

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

  • Pretty Breaks: Computes a sequence of about n+1 equally spaced nice values which cover the range of the values in x. The values are chosen so that they are 1, 2 or 5 times a power of 10. (based on pretty from the R statistical environment https://astrostatistics.psu.edu/datasets/R/html/base/html/pretty.html)

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

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

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

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

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

  • Change Color… of the selected symbol(s)

  • Change Opacity… of the selected symbol(s)

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

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

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

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

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

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

Opciones de Simbolización Graduada

Truco

Mapas temáticos usando una expresión

Categorized and graduated thematic maps can be created using the result of an expression. In the properties dialog for vector layers, the attribute chooser is extended with a expression Set column expression function. So you don’t need to write the classification attribute to a new column in your attribute table if you want the classification attribute to be a composite of multiple fields, or a formula of some sort.

Símbolo proporcional y Análisis Multivariante

El símbolo proporcional y el análisis multivariado no son tipos de representación disponibles en la lista desplegable de representación de simbología. Sin embargo con el data-defined override opciones aplicadas sobre cualquiera de las opciones de representación anteriores, QGIS le permite mostrar sus datos de punto y línea con dicha representación.

Crear símbolo proporcional

Para aplicar un renderizado proporcional:

  1. Primero aplique a la capa el single symbol renderer.

  2. Luego establezca el el símbolo a aplicar a las entidades.

  3. Seleccione el elemento en el nivel superior del árbol de símbolos y use el dataDefined Data-defined override button próximo a la opción Size (para capa de puntos) o Width (para capa de lineas).

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

    Si fuera necesario, use la opción Size assistant… de | dataDefined | menú para aplicar alguna transformación (exponencial, flannery …) al cambio de tamaño del símbolo(ver Using the data-defined assistant interface fpara mas detalles).

Puede elegir mostrar los símbolos proporcionales en el Layers panel y el print layout legend item: desplegue el Advanced lista desplegable en la parte inferior del cuadro de diálogo principal de la pestaña Symbology y seleccione Data-defined size legend… para configurar los elementos de la leyenda (ver Data-defined size legend para detalles).

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

Scaling airports size based on elevation of the airport

Crear análisis multivariable

A multivariate analysis rendering helps you evaluate the relationship between two or more variables e.g., one can be represented by a color ramp while the other is represented by a size.

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

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

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

    1. Click en el botón Change sobre el cuadro de la clasificación: accederá al diálogo The Symbol Selector.

    2. Cambie la escala del tamaño o el ancho de la capa de símbolo utilizando el widget dataDefined data defined override como se muestra encima.

Al igual que el símbolo proporcional, la simbología escalada se puede agregar al árbol de capas, encima de los símbolos de clases graduadas o categorizadas utilizando la función data defined size legend. Y ambas representaciones también están disponibles en el elemento de leyenda de diseño de impresión.

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

Multivariate example with scaled size legend

Renderizado basado en reglas

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

Para crear una regla:

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

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

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

  4. Utilice las funciones proporcionadas y los atributos de capa para construir una expression para filtrar las entidades que le gustaría recuperar. Presione el botón Test para verificar el resultado de la consulta.

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

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

  7. Finalmente, configure el symbol to use para estas entidades.

  8. Y presione OK.

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

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

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

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

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

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

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

  • Change Color… of the selected symbol(s)

  • Change Opacity… of the selected symbol(s)

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

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

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

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

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

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

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

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

Opciones de simbología basada en reglas

Point displacement Renderer

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

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

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

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

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

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

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

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

Cuadro de diálogo de desplazamiento de punto

Nota

El renderizador de desplazamiento de puntos no altera la geometría de la entidad, lo que significa que los puntos no se mueven de su posición. Todavía se encuentran en su lugar inicial. Los cambios son solo visuales, para fines de representación. Utilice en su lugar el algoritmo de procesamiento Desplazamiento de puntos si quiere crear geometrías desplazadas.

Point Cluster Renderer

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

From the main dialog, you can:

  • establecer el símbolo para representar el grupo de puntos en el Cluster symbol; la representación predeterminada muestra el número de características agregadas gracias a``@cluster_size`` variable en la capa de símbolo de marcador de Fuente.

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

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

Point Cluster dialog

Nota

El renderizador de agrupación de puntos no altera la geometría de la entidad, lo que significa que los puntos no se mueven de su posición. Todavía se encuentran en su lugar inicial. Los cambios son solo visuales, para fines de representación. Utilice en su lugar el procesamiento K-means clustering o el algoritmo DBSCAN clustering si quiere crear entidades basadas en clúster.

Inverted Polygon Renderer

The invertedSymbol Inverted Polygon renderer allows user to define a symbol to fill in outside of the layer’s polygons. As above you can select subrenderers, namely Single symbol, Graduated, Categorized, Rule-Based or 2.5D renderer.

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

Inverted Polygon dialog

Renderizado de mapa de calor

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

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

Diálogo Mapa de calor

Renderizador 2.5D

Using the 25dSymbol 2.5D renderer it’s possible to create a 2.5D effect on your layer’s features. You start by choosing a Height value (in map units). For that you can use a fixed value, one of your layer’s fields, or an expression. You also need to choose an Angle (in degrees) to recreate the viewer position (0° means west, growing in counter clock wise). Use advanced configuration options to set the Roof Color and Wall Color. If you would like to simulate solar radiation on the features walls, make sure to check the checkbox Shade walls based on aspect option. You can also simulate a shadow by setting a Color and Size (in map units).

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

Diálogo 2.5D

Truco

Uso del efecto 2.5D con otros renderizadores

Once you have finished setting the basic style on the 2.5D renderer, you can convert this to another renderer (single, categorized, graduated). The 2.5D effects will be kept and all other renderer specific options will be available for you to fine tune them (this way you can have for example categorized symbols with a nice 2.5D representation or add some extra styling to your 2.5D symbols). To make sure that the shadow and the «building» itself do not interfere with other nearby features, you may need to enable Symbols Levels ( Advanced ‣ Symbol levels…). The 2.5D height and angle values are saved in the layer’s variables, so you can edit it afterwards in the variables tab of the layer’s properties dialog.

Reproducción de capas

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

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

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

  • Aplicar paint effects en todas las entidades de la capa con el botón Draw Effects.

  • Control feature rendering order allows you, using features attributes, to define the z-order in which they shall be rendered. Activate the checkbox and click on the sort button beside. You then get the Define Order dialog in which you:

    1. Elija un campo o cree una expresión para aplicar a las entidades de capa.

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

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

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

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

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

Layer rendering options

Otras Configuraciones

Symbol levels

For renderers that allow stacked symbol layers (only heatmap doesn’t) there is an option to control the rendering order of each symbol’s levels.

Para la mayoría de los renderizadores, puede acceder a la opción de niveles de Símbolos haciendo clic en el botón Advanced debajo de la lista de símbolos guardados y elegidos Symbol levels. Para la Renderizado basado en reglas la opción está disponible directamente mediante el botón Symbols Levels… , mientras para Point displacement Renderer renderizador el mismo botón está dentro del diálogo Rendering settings.

To activate symbols levels, select the checkbox Enable symbol levels. Each row will show up a small sample of the combined symbol, its label and the individual symbols layer divided into columns with a number next to it. The numbers represent the rendering order level in which the symbol layer will be drawn. Lower values levels are drawn first, staying at the bottom, while higher values are drawn last, on top of the others.

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

Symbol levels dialog

Nota

If symbols levels are deactivated, the complete symbols will be drawn according to their respective features order. Overlapping symbols will simply obfuscate to other below. Besides, similar symbols won’t «merge» with each other.

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

Symbol levels activated (A) and deactivated (B) difference

Data-defined size legend

Cuando una capa es renderizada con la proportional symbol or the multivariate rendering o cuando se aplica a la capa un scaled size diagram , puede permitir la visualización de los símbolos escalados tanto en el Layers panel y en print layout legend.

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

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

  • fije el symbol to use para la representación de leyenda;

  • Inserte el título en la leyenda;

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

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

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

Setting size scaled legend

Nota

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

Efectos de dibujo

In order to improve layer rendering and avoid (or at least reduce) the resort to other software for final rendering of maps, QGIS provides another powerful functionality: the paintEffects Draw Effects options, which adds paint effects for customizing the visualization of vector layers.

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

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

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

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

    Efectos de dibujo: cuadro de diálogo Fuente

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

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

    Efectos de dibujo: cuadro de diálogo Difuminar

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

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

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

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

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

    Efectos de dibujo: cuadro de diálogo Dar Color

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

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

    Efectos de dibujo: cuadro de diálogo Sombra exterior

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

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

    Efectos de dibujo: cuadro de diálogo Sombra interior

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

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

    Efectos de dibujo: cuadro de diálogo Brillo interior

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

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

    Efectos de dibujo: cuadro de diálogo Brillo exterior

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

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

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

    • Rotation: Turns the feature around its center point.

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

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

    Efectos de dibujo: cuadro de diálogo Transformar

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

There are some common options available for all draw effect types. Opacity and Blend mode options work similar to the ones described in Reproducción de capas and can be used in all draw effects except for the transform one.

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

  • Effects render from top to bottom.

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

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

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

Propiedades de etiquetas

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

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

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

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

  • labelingRuleBased Rule-based labeling

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

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

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

Layer labeling settings - Single labels

At the top of the dialog, a Value drop-down list is enabled. You can select an attribute column to use for labeling. By default, the display field is used. Click expression if you want to define labels based on expressions - See Definir etiquetas basadas en expresiones.

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

Description of how to set each property is exposed at Setting a label.

Setting the automated placement engine

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

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

The labels automated placement engine

  • The Number of candidates controls how many label placement candidates should be generated for each feature type. The more candidates generated, the better the labeling will be - but at a cost of rendering speed. Smaller number of candidates results in less labels placed but faster redraws.

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

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

  • unchecked Show all labels for all layers (i.e. including colliding objects). Note that this option can be also set per layer (see Rendering tab)

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

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

Etiquetado basado en reglas

With rule-based labeling multiple label configurations can be defined and applied selectively on the base of expression filters and scale range, as in Rule-based rendering.

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

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

Configuración de reglas

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

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

Panel de etiquetado basado en reglas

Definir etiquetas basadas en expresiones

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

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

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

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

Usar expresiones para etiquetado

Expression based labeling is easy to work with. All you have to take care of is that:

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

  • Strings are written in “single quotes”.

  • Fields are written in «double quotes» or without any quote.

Let’s have a look at some examples:

  1. Label based on two fields “name” and “place” with a comma as separator:

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

    Devuelve:

    John Smith, Paris
    
  2. Label based on two fields “name” and “place” with other texts:

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

    Devuelve:

    My name is John Smith and I live in Paris
    
  3. Label based on two fields “name” and “place” with other texts combining different concatenation functions:

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

    Devuelve:

    My name is John Smith and I live in Paris
    

    Or, if the field “place” is NULL, returns:

    My name is John Smith
    
  4. Multi-line label based on two fields “name” and “place” with a descriptive text:

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

    Devuelve:

    My name is John Smith
    I live in Paris
    
  5. Label based on a field and the $area function to show the place’s name and its rounded area size in a converted unit:

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

    Devuelve:

    The area of Paris has a size of 10500 ha
    
  6. Create a CASE ELSE condition. If the population value in field population is <= 50000 it is a town, otherwise it is a city:

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

    Devuelve:

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

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

    Devuelve:

    Paris
    

As you can see in the expression builder, you have hundreds of functions available to create simple and very complex expressions to label your data in QGIS. See Expresiones chapter for more information and examples on expressions.

Using data-defined override for labeling

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

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

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

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

To do this, after you enabled the labeling on the NAME field of the layer (see Setting a label):

  1. Activate the Text tab.

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

  3. Select Edit… and type:

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

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

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

Likewise, you can customize any other property of the label, the way you want. See more details on the dataDefined Data-define override widget’s description and manipulation in Configuración de anulación definida por datos section.

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

Airports labels are formatted based on their attributes

Truco

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

There is an option to set the labeling for multi-part features independently from your label properties. Choose the render Rendering, Feature options, go to the dataDefined Data-define override button next to the checkbox unchecked Label every part of multipart-features and define the labels as described in Configuración de anulación definida por datos.

La Barra de Herramientas Etiqueta

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

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

La barra de herramientas Etiqueta

While for readability, label has been used below to describe the Label toolbar, note that when mentioned in their name, the tools work almost the same way with diagrams:

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

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

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

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

  • moveLabel Move Label And Diagram. You just have to drag the label to the desired place.

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

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

Advertencia

Label tools overwrite current field values

Using the Label toolbar to customize the labeling actually writes the new value of the property in the mapped field. Hence, be careful to not inadvertently replace data you may need later!

Nota

The Auxiliary Storage Properties mechanism may be used to customize labeling (position, and so on) without modifying the underlying data source.

Customize the labels from the map canvas

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

  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 dataDefined icon to define the field type for the Coordinate. Choose xlabel for X and ylabel for Y. The icons are now highlighted in yellow.

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

    Labeling of vector polygon layers with data-defined override

  4. Acercamiento a un lago

  5. Set editable the layer using the toggleEditing Toggle Editing button.

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

  7. Using The Geometry Generator with the expression below, you can also add a linestring symbol layer to connect each lake to its moved label:

    make_line( centroid( $geometry ), make_point( "xlabel", "ylabel" ) )
    
    ../../../_images/move_label.png

    Mover etiquetas

Nota

The Auxiliary Storage Properties mechanism may be used with data-defined properties without having an editable data source.

Propiedades de diagrama

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

The current core implementation of diagrams provides support for:

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

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

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

  • and histogram Histograms.

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

Truco

Switch quickly between types of diagrams

Given that the settings are almost common to the different types of diagram, when designing your diagram, you can easily change the diagram type and check which one is more appropriate to your data without any loss.

For each type of diagram, the properties are divided into several tabs:

Atributos

Attributes defines which variables to display in the diagram. Use signPlus add item button to select the desired fields into the “Assigned Attributes” panel. Generated attributes with Expresiones can also be used.

You can move up and down any row with click and drag, sorting how attributes are displayed. You can also change the label in the “Legend” column or the attribute color by double-clicking the item.

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

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

Propiedades de diagrama - pestaña de Atributos

Representación

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

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

  • and, depending on the type of diagram:

    • the width of the bar in case of histogram;

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

    • the orientation of the left line of the first slice represented in pie chart. Note that slices are displayed clockwise.

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

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

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

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

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

  • setting the Scale dependent visibility;

  • Discourage diagrams and labels from covering features: defines features to use as obstacles, ie QGIS will try to not place diagrams nor labels over these features.

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

Diagram properties - Rendering tab

Tamaño

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

  • Fixed size, an unique size to represent the graphic of all the features, except when displaying histogram

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

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

Propiedades de diagrama - pestaña de tamaño

Ubicación

Placement helps to define diagram position. According to the layer geometry type, it offers different options for the placement:

  • “Over the point” or “Around the point” for point geometry. The latter variable requires a radius to follow.

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

  • “Over the centroid”, “Around the centroid” (with a distance set), “Perimeter” and anywhere “Inside polygon” are the options for polygon features.

The diagram can also be placed using feature data to fill the coordinates X and Y fields.

The placement of the diagrams can interact with the labeling, so you can detect and solve position conflicts between diagrams and labels by setting the Priority slider value.

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

Vector properties dialog with diagram properties, Placement tab

Opciones

The Options tab has settings only in case of histogram. You can choose whether the bar orientation should be “Up”, “Down”, “Right” and “Left”.

Leyenda

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

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

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

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

Estudio de Caso

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 Downloading sample data).

  1. Primero haga clic sobre el icono addOgrLayer Añadir capa vectorial, navegue a la carpeta del conjunto de datos de ejemplo de |qg| y cargue las dos capas vectoriales alaska.shp y climate.shp.

  2. pulsar doble en la capa «climate» en la leyenda del mapa para abrir el diálogo de la :guilabel: «Propiedades de la capa»

  3. Click on the Diagrams tab and from the Diagram type selectString combo box, 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 “Around 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. So, in the Attributes tab first select T_F_JAN and click the signPlus button, then repeat with 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. Activate the radioButtonOn Scaled size and set the size of the diagrams on the basis of the maximum value of an attribute and the Size option. 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_mapped gives an idea of the result.

  10. Finally, click OK.

../../../_images/climate_diagram.png

Gráfico de temperatura sobrepuesto en un mapa

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. You can also set a scale-dependent visibility in the Appearance tab.

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

Utilice suplantación definida por datos

As mentioned above, you can use some custom data-defined to tune the diagrams rendering:

  • position in Placement tab by filling X and Y fields

  • visibility in Appearance tab by filling the Visibility field

Vea Using data-defined override for labeling para más información.

3D View Properties

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

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

  • Single symbol: features are rendered using a common symbol whose properties can be data-defined or not

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

Depending on the layer geometry type, various properties are available for 3D rendering.

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

3D properties of a polygon layer

Point Layers

  • You can define different simple 3D shapes like Sphere, Cylinder, Cube, Cone, Plane and Torus defined by their Radius, Size or Length. The unit of size of the 3D shapes refers to the CRS of the project.

  • The shading of the 3D shapes can be defined by the menus Diffuse, Ambient, Specular and Shininess (see https://en.wikipedia.org/wiki/Phong_reflection_model#Description)

  • If you choose 3D Model, the location will be determined by a simple point coordinate.

  • For visualizing 3D point clouds you can use Billboard Shapes defined by the Billboard Height, Billboard symbol and Altitude clamping. The symbol will have a stable size.

  • Altitude clamping can be set to Absolute, Relative or Terrain. The Absolute setting can be used when height values of the 3d vectors are provided as absolute measures from 0. Relative and Terrain add given elevation values to the underlying terrain elevation.

  • Translation can be used to move objects in x, y and z axis.

  • You can define a Scale factor for the 3D shape as well as a Rotation around the x-, y- and z-axis.

Line layers

  • Beneath the Width and Height settings you can define the Extrusion of the vector lines. If the lines do not have z-values, you can define the 3d volumes with this setting.

  • With the Altitude clamping you define the position of the 3D lines relative to the underlying terrain surface, if you have included raster elevation data or other 3D vectors.

  • The Altitude binding defines how the feature is clamped to the terrain. Either every Vertex of the feature will be clamped to the terrain or this will be done by the Centroid.

  • It is possible to checkboxRender as simple 3D lines.

  • The shading can be defined in the menus Diffuse, Ambient, Specular and Shininess.

Polygon Layers

  • As for the other ones, Height can be defined in CRS units.

  • Again, Extrusion is possible for missing z-values.

  • The Altitude clamping, Altitude binding can be defined as explained above.

  • There is an additional option to checkboxAdd back faces and checkboxInvert normals.

  • You can define checkboxEdges by Width and Color.

Application example

To go through the settings explained above you can have a look at https://public.cloudmergin.com/projects/saber/luxembourg/tree.

Fields Properties

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

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

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

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

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

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

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

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

Fields properties tab

Attributes Form Properties

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

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

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

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

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

Customizing a form for your data

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

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

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

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

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

The autogenerated form

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

El diseñador de arrastrar y soltar

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

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

Resulting built-in form with tabs and named groups

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

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

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

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

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

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

      • the name

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

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

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

      Dialog to create containers with the Attribute editor layout

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

      • hide or show the container’s label

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

      • rename the container

      • set the number of columns

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

      • add a background color

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

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

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

    • hide or show the relation label

    • show the link button

    • show the unlink button

  7. Apply the layer’s properties dialog

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

Using custom ui-file

The Provide ui-file option allows you to use complex dialogs made with Qt-Designer. Using a UI-file allows a great deal of freedom in creating a dialog. Note that, in order to link the graphical objects (textbox, combobox…) to the layer’s fields, you need to give them the same name.

Use the Edit UI to define the path to the file to use.

You’ll find some example in the Creating a new form lesson of the Manual de Aprendizaje QGIS. For more advanced information, see https://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/.

Enhance your form with custom functions

QGIS forms can have a Python function that is called when the dialog is opened. Use this function to add extra logic to your dialogs. The form code can be specified in three different ways:

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

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

  • provide code in this dialog: a Python editor will appear where you can directly type the function to use.

In all cases you must enter the name of the function that will be called (open in the example below).

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: open

Configurar el comportamiento del campo

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

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

Dialog to select an edit widget for an attribute column

Configuración común

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

Widget display

Show label: indicates whether the field name should be displayed in the form.

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

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

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

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

Valores predeterminados
  • Default value: for new features, automatically populates by default the field with a predefined value or an expression-based one. For example, you can:

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

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

    • save the feature creation datetime using now();

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

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

    Nota

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

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

Constraints

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

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

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

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

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

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

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

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

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

Modo de edición

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

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

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

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

  • Date/Time: Displays a line field which can open a calendar widget to enter a date, a time or both. Column type must be text. You can select a custom format, pop-up a calendar, etc.

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

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

  • Hidden: A hidden attribute column is invisible. The user is not able to see its contents.

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

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

  • Range: Allows you to set numeric values from a specific range. The edit widget can be either a slider or a spin box.

  • Relation Reference: This widget lets you embed the feature form of the referenced layer on the feature form of the actual layer. See Creating one or many to many relations.

  • Text Edit (default): This opens a text edit field that allows simple text or multiple lines to be used. If you choose multiple lines you can also choose html content.

  • Unique Values: You can select one of the values already used in the attribute table. If “Editable” is activated, a line edit is shown with autocompletion support, otherwise a combo box is used.

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

  • Value Map: A combo box with predefined items. The value is stored in the attribute, the description is shown in the combo box. You can define values manually or load them from a layer or a CSV file.

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

Truco

Relative Path in Attachment widget

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

Propiedades de unión

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

To create a join:

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

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

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

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

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

Join an attribute table to an existing vector layer

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

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

  • unchecked Create attribute index on the join field

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

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

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

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

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

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

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

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

Auxiliary Storage Properties

The regular way to customize styling and labeling is to use data-defined properties as described in Configuración de anulación definida por datos. However, it may not be possible if the underlying data is read only. Moreover, configuring these data-defined properties may be very time consuming or not desirable! For example, if you want to fully use map tools coming with La Barra de Herramientas Etiqueta, then you need to add and configure more than 20 fields in your original data source (X and Y positions, rotation angle, font style, color and so on).

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

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

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

Auxiliary Storage tab

Labeling

Considering that the data source may be customized thanks to data-defined properties without being editable, labeling map tools described in La Barra de Herramientas Etiqueta are always available as soon as labeling is activated.

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

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

Auxiliary Layer creation dialog

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

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

Auxiliary Layer key

The auxiliary layer now has these characteristics:

  • the primary key is ID,

  • there are 0 features using an auxiliary field,

  • there are 0 auxiliary fields.

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

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

Auxiliary Fields

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

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

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

Data-defined properties automatically created

Otherwise, there’s another way to create an auxiliary field for a specific property thanks to the dataDefined data-defined override button. By clicking on Store data in the project, an auxiliary field is automatically created for the Opacity field. If you click on this button whereas the auxiliary layer is not created yet, then the window Auxiliary Layer creation dialog is first displayed to select the primary key to use for joining.

Simbología

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

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

Data-defined property menu for symbol

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

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

Name of the auxiliary field for a symbol

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

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

Auxiliary field symbol

Attribute table and widgets

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

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

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

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

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

Form with auxiliary fields

Management

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

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

Auxiliary layer management

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

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

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

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

Auxiliary storage database

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

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

Propiedades de acciones

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.

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

Overview action dialog with some sample actions

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 divided into six types and can be used like this:

  • Las acciones genéricas, Mac, Windows inician un proceso externo.

  • Las acciones Python ejecutan una expresión Python.

  • Las acciones genéricas y Python son visibles en todos lados.

  • 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 by clicking on Create Default Actions. To edit any of the examples, double-click its row. One example is performing a search based on an attribute value. This concept is used in the following discussion.

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

Definir Acciones

To define an attribute action, open the vector Layer Properties dialog and click on the Actions tab. In the Actions tab, click the signPlus Add a new action to open the Edit Action dialog.

Select the action Type and provide a descriptive name for the action. The action itself must contain the name of the application that will be executed when the action is invoked. You can add one or more attribute field values as arguments to the application. When the action is invoked, any set of characters that start with a % followed by the name of a field will be replaced by the value of that field. The special characters %% will be replaced by the value of the field that was selected from the identify results or attribute table (see using_actions below). Double quote marks can be used to group text into a single argument to the program, script or command. Double quotes will be ignored if preceded by a backslash.

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

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

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

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

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

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 proceeding 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.

Two example actions are shown below:

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

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

In the first example, the web browser konqueror is invoked and passed a URL to open. The URL performs a Google search on the value of the nam field from our vector layer. Note that the application or script called by the action must be in the path, or you must provide the full path. To be certain, we could rewrite the first example as: /opt/kde3/bin/konqueror https://www.google.com/search?q=%nam. This will ensure that the konqueror application will be executed when the action is invoked.

The second example uses the %% notation, which does not rely on a particular field for its value. When the action is invoked, the %% will be replaced by the value of the selected field in the identify results or attribute table.

Empleando Acciones

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

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

  • when right-clicking a feature with the identify Identify Features tool (see Identifying Features for more information);

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

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

Si se está invocando una acción que utilice la notación ```` , haga clic derecho en el valor del campo en el cuadro de diálogo Resultados de la Identificación o en Tabla de atributos que desee pasar de la aplicación o script

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"

Después de seleccionar algunas localidades y ejecutar la acción en cada una, al abrir el archivo de salida mostrará algo como esto:

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

As an exercise, we can create an action that does a Google search on the lakes layer. First, we need to determine the URL required to perform a search on a keyword. This is easily done by just going to Google and doing a simple search, then grabbing the URL from the address bar in your browser. From this little effort, we see that the format is https://www.google.com//search?q=QGIS, where QGIS is the search term. Armed with this information, we can proceed:

  1. Asegúrese de que la capa de lakes esté cargada.

  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. Haga clic en la pestaña Acciones

  4. Click signPlus Add a new action.

  5. Choose the Open action type,

  6. Ingrese un nombre para la acción , por ejemplo Búsqueda de Google.

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

  8. Choose the action Scope. See Definir Acciones for further information. Leave the default settings for this example.

  9. Para la acción, se necesita proporcionar el nombre del programa externo a ejecutar. En este caso, podemos utilizar Firefox. Si el programa no está en su ruta, se necesita proporcionar la ruta completa.

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

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

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

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

  14. Su texto de acción ahora se ve así:

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

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

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

Edit action dialog configured with the example

This completes the action, and it is ready to use. The final text of the action should look like this:

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

Ahora podemos utilizar la acción. Cierre el cuadro de diálogo Propiedades de la capa y acérquese a un área de interés. Asegure que la capa capa lakes este activa e identifique un lago. En la caja de resultados, ahora verá que su acción es visible.

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

Seleccionar objetos espaciales y elegir una acción

When we click on the action, it brings up Firefox and navigates to the URL https://www.google.com/search?q=Tustumena. It is also possible to add further attribute fields to the action. Therefore, you can add a + to the end of the action text, select another field and click on Insert Field. In this example, there is just no other field available that would make sense to search for.

You can define multiple actions for a layer, and each will show up in the Identify Results dialog.

You can also invoke actions from the attribute table by selecting a row and right-clicking, then choosing the action from the pop-up menu.

There are all kinds of uses for actions. For example, if you have a point layer containing locations of images or photos along with a file name, you could create an action to launch a viewer to display the image. You could also use actions to launch web-based reports for an attribute field or combination of fields, specifying them in the same way we did in our Google search example.

We can also make more complex examples, for instance, using Python actions.

Usually, when we create an action to open a file with an external application, we can use absolute paths, or eventually relative paths. In the second case, the path is relative to the location of the external program executable file. But what about if we need to use relative paths, relative to the selected layer (a file-based one, like Shapefile or SpatiaLite)? The following code will do the trick:

command = "firefox"
imagerelpath = "images_test/test_image.jpg"
layer = qgis.utils.iface.activeLayer()
import os.path
layerpath = layer.source() if layer.providerType() == 'ogr'
  else (qgis.core.QgsDataSourceURI(layer.source()).database()
    if layer.providerType() == 'spatialite' else None)
path = os.path.dirname(str(layerpath))
image = os.path.join(path,imagerelpath)
import subprocess
subprocess.Popen( [command, image ] )

We just have to remember that the action is one of type Python and the command and imagerelpath variables must be changed to fit our needs.

But what about if the relative path needs to be relative to the (saved) project file? The code of the Python action would be:

command = "firefox"
imagerelpath = "images/test_image.jpg"
projectpath = qgis.core.QgsProject.instance().fileName()
import os.path
path = os.path.dirname(str(projectpath)) if projectpath != '' else None
image = os.path.join(path, imagerelpath)
import subprocess
subprocess.Popen( [command, image ] )

Another Python action example is the one that allows us to add new layers to the project. For instance, the following examples will add to the project respectively a vector and a raster. The names of the files to be added to the project and the names to be given to the layers are data driven (filename and layername are column names of the table of attributes of the vector where the action was created):

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

Para añadir un ráster (una imagen TIF en este ejemplo), se vuelve:

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

Propiedades a mostrar

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

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

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

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

    • the feature identifier in the attribute table form view;

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

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

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

Código HTML para textos de aviso del mapa

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

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

Textos de aviso del mapa con código HTML

Propiedades de representación

Visibilidad dependiente de escala

You can set the Maximum (inclusive) and Minimum (exclusive) scale, defining a range of scale in which features will be visible. Out of this range, they are hidden. The mapIdentification Set to current canvas scale button helps you use the current map canvas scale as boundary of the range visibility. See Renderizado dependiente de la escala for more information.

Simplify geometry

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

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

cuadro de diálogo de Simplificación de Geometría de capa

Nota

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.

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

Checking checkbox Force layer to render as raster forces these layers to be rasterised so that the exported files won’t have to include all the nodes contained in these layers and the rendering is therefore sped up.

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

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

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

Propiedades de variables

expression The Variables tab lists all the variables available at the layer’s level (which includes all global and project’s variables).

It also allows the user to manage layer-level variables. Click the signPlus button to add a new custom layer-level variable. Likewise, select a custom layer-level variable from the list and click the signMinus button to remove it.

Más información sobre el uso de variables en la sección de herramientas Generales Storing values in Variables

Propiedades de metadatos

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

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

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

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

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

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

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

  • the Links to ancillary resources and related information;

  • the History of the dataset.

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

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

Dependencies Properties

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

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

Propiedades de la leyenda

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

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

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

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

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

    By default, QGIS provides transparency widget but this can be extended by plugins registering their own widgets and assign custom actions to layers they manage.

QGIS Server Properties

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

You can add or edit a title and abstract for the layer in the Description section. It’s also possible to define a Keyword list here. These keyword lists can be used in a metadata catalog. If you want to use a title from an XML metadata file, you have to fill in a link in the DataUrl field.

Use Attribution to get attribute data from an XML metadata catalog.

In MetadataUrl, you can define the general path to the XML metadata catalog. This information will be saved in the QGIS project file for subsequent sessions and will be used for QGIS server.

In the LegendUrl section, you can provide the url of a legend image in the url field. You can use the Format drop-down option to apply the appropriate format of the image. Currently png, jpg and jpeg image formats are supported.

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

QGIS Server tab in vector layers properties dialog

Digitizing Properties

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

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

The QGIS Digitizing tab in the vector layers properties dialog

Automatic Fixes

Options in the Automatic Fixes section will directly affect the vertices of any geometry which is added or modified. If the checkbox Remove duplicate nodes option is checked, any two subsequent vertices with exactly the same coordinates will be removed. If the Geometry precision is set, all vertices will be rounded to the closest multiple of the configured geometry precision. The rounding will happen in the layer coordinate reference system. Z and M values are not rounded. With many map tools, a grid is shown on the canvas while digitizing.

Geometry Checks

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

Topology Checks

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

Topology check option

Illustration

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

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

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

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

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

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

Gap check exceptions

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

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

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

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

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