Estilo Básico Vectorial (QGIS3)

Para crear un mapa, se debe dar estilo a los datos SIG y presentarlos en una forma visualmente informativa. Hay un gran número de opciones disponibles en QGIS para aplicar diferentes tipos de simbología a los datos por detrás. En este tutorial, tomaremos un archivo texto y aplicaremos diferentes técnicas de visualización para resaltar patrones espaciales en los datos.

Vista general de la tarea

Tomaremos un archivo CSV que contiene la ubicación de todas las plantas de energía en el mundo y crearemos una visualización que muestra la distribución de combustibles renovables y no-renovables usados en estas plantas de energía.

Otras habilidades que aprenderá

  • Usar expresiones para agrupar múltiples valores de atributos en una sola categoría.

Obtener los datos

El World Resources Institute ha compilado una base de datos extensa, de código abierto de plantas de energía alrededor del mundo que cubren más de 30000 plantas. Descargue la The Global Power Plant Database del Portal WRI Open Data.

Natural Earth tiene varioas capas vectoriales. Descargue 10m Physical Vectors - Land que contiene poligonos de Tierra.

Para su comodidad, puede descargar directamente una copia de las capas mencionadas previamente de aquí abajo:

globalpowerplantdatabasev120.zip

ne_10m_land.zip

Fuente de Datos [WRI] [NATURALEARTH]

Procedimiento

  1. Descomprima ambos conjuntos de datos a una carpeta en su computadora. En el Panel del Explorador QGIS, localice el directorio donde extrajo los datos. Expanda la carpeta ne_10m_land y selecciones la capa ne_10m_land.shp. Arrastre la capa a la pantalla.

../../_images/114.png
  1. Verá una nueva capa ne_10m_land agregada al panel Capas. La base de datos global de plantas de energía viene como un archivo CSV, por lo que necesitamos importarlo. Clic en el botón Abrir el Administrador de Fuente de Datos en la Barra de Herramientas Fuente de Datos. También puede usar el atajo de teclado Ctrl + L.

../../_images/213.png
  1. En la ventana Administrador de Fuente de Datos, cambie a la pestaña Texto Delimitado. Clic en el botón ... junto a Nombre de archivo y explore al directorio donde extrajo el archivo globalpowerplantdatabasev120.zip. Seleccione global_power_plant_database.csv. QGIS detectará automáticamente el delimitador y campos de geometría. Deje la SRC Geometría al valor predeterminado EPSG:4326 - WGS84. Clic en Agregar seguido por Cerrar.

../../_images/312.png
  1. Una nueva capa global_power_plant_database será agregada al panel Capas y verá los puntos que representan las plantas de energía en la pantalla. Ahora estamos listos para dar estilo a ambas capas. Clic en el botón Abrir el panel de Estilo de Capa en la parte de arriba del panel Capas.

../../_images/44.png
  1. El panel Estilo de Capa se abrirá a la derecha. Seleccione primero la capa ne_10m_land. Esta setá nuestra capa base por lo que mantendremos el estilo minimalista para no distraiga. Clic en Llenado simple y deslice hacia abajo. Seleccione un Color de relleno a su gusto. Clic en el menú desplegable junto a Color de contorno y seleccione Contorno Transparente. Esto definirá los contornos de los polígonos de tierras como transparentes. Verá el resultado de su selección aplicado inmediatamente a la capa.

../../_images/54.png
  1. A continuación, seleccione la capa global_power_plant_database. Clic en Marcador simple y desplácese hacia abajo. Elija un marcador triángulo.

../../_images/64.png
  1. Scroll up and select a Fill color of your liking. A useful cartographic technique is to choose a slightly darker version of the fill-color as the Stroke color. Rather than trying to pick that manually, QGIS provides an expression to control this more precisely. Click the Data defined override button and choose Edit.
../../_images/74.png
  1. Enter the following expression to set the color to be 30% darker shade than the fill color and click OK.
darker(@symbol_color, 130)
../../_images/84.png

Nota

Note that this expression is independent of the fill color you have chosen. You will see that this is immensely useful in the following steps where it automatically sets the border color based on the fill color provided.

  1. You will notice that the Data defined override button next to Stroke color has turned yellow - indicating than this property is controlled by an override. A single symbol rendering of the power plants layer is not very useful. It doesn’t convey much information except the locations of the power plants. Let’s use a different renderer to make it more useful. Click the Symbology drop-down and select Categorized renderer.
../../_images/94.png
  1. The global_power_plant_database layer contains an attribute indicating the primary fuel used in each power plant. We can create a style where each unique fuel type is shown in a different color. Select primary_fuel as the Column. Click Classify. You will multiple categories appear and the map rendering change accordingly.
../../_images/104.png
  1. While a Categorized view is useful, this layer contains too-many categories for one to meaningfully interpret the map. A better approach would be to group certain type of fuel categories and reduce the number of classes. Let’s try to create 3 categories - Renewable fuel, Non-renewable fuel and Other. Select Rule-based renderer. Select all but one rules by holding the Ctrl key and clicking on each row. Once selected, click the Remove selected rules button to delete them.
../../_images/115.png
  1. Select the remaining rule and click Edit current rule.
../../_images/124.png
  1. Enter Renewable fuel as the Label. Click the Expression button next to Filter.
../../_images/134.png
  1. In the Expression String Builder dialog, enter the following expression and click OK. Here we are grouping multiple renewable energy categories into a single category.
"primary_fuel" IN ('Biomass', 'Geothermal', 'Hydro', 'Solar', 'Wind', 'Storage', 'Wave and Tidal')
../../_images/144.png

Nota

The types of fuel chosen for renewable vs. non-renewable categories is based on Wikipedia. There are alternate definitions and classifications that may not match what is chosen here.

  1. Scroll down and click Simple marker. Choose an appropriate Fill color. Once done, click the Back button.
../../_images/154.png
  1. You will see a single rule being applied to the layer for the Renewable fuel category. Right-click the row and choose Copy. Right-click again and choose Paste.
../../_images/164.png
  1. A copy of the existing rule will be added. Select the newly added row and click Edit current rule.
../../_images/174.png
  1. Enter Non-renewable fuel as the Label. Click the Expression button next to Filter.
../../_images/183.png
  1. In the Expression String Builder dialog, enter the following expression and click OK.
"primary_fuel" IN ('Coal', 'Gas', 'Nuclear', 'Oil', 'Petcoke')
../../_images/193.png
  1. Scroll down and click Simple marker. Choose an appropriate Fill color. Once done, click the Back button.
../../_images/202.png
  1. Repeat the Copy/Paste process to add a third rule. Select it and click Edit current rule.
../../_images/214.png
  1. Enter Other as the Label. Choose Else - Catch all for other features instead of a Filter. This will ensure that any category missed in the previous 2 rules, will be styled by this rule. Scroll down and click Simple marker. Choose an appropriate Fill color. Once done, click the Back button.
../../_images/222.png
  1. The re-categorization is complete now. You will see a much cleaner view that shows the distribution of renewable vs. non-renewable fuel sources used by power plants and their distribution across countries. This however doesn’t give a complete picture. We can add another variable to the styling. Rather than displaying all markers with uniform size, we can show the sizes proportional to the power generation capacity of each plant. This cartography technique is called Multivariate mapping. Right-click the Renewable fuel rule and select Change Size.
../../_images/231.png
  1. Click the Data defined override button next to Size. Select Edit.
../../_images/241.png
  1. As the power generation capacity varies a lot among our dataset, an effective way to get a a small range for size is using the log10 function. You can experiment with different expressions to arrive at what works best for your preferred visualization. Enter the following expression and click OK.
log10("capacity_mw") + 1
../../_images/251.png
  1. Repeat the same process for other rules.
../../_images/261.png
  1. Once satisfied, you can close the Layer Styling panel.
../../_images/271.png
  1. Looking at our final visualization, you can immediately see the patterns in the dataset. For example, over Europe there are more power plants that use renewable energy source, but they are lower capacity than the plants that use non-renewable energy source.
../../_images/281.png
If you liked tutorials on this site and do check out spatialthoughts.com for more free resources.
comments powered by Disqus

This work is licensed under a Creative Commons Attribution 4.0 International License