Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
podcast
Filter by Categories
Galleries
Print Category 1
Print Category 2
Uncategorized

Mesh data in QGIS

Mesh data in QGIS

This article will cover the following areas.

  1. Definition of mesh data as first-class data format similar to vector and raster formats.
  2. Mesh data standards
  3. When to use mesh data and not vector or raster.
  4. MDAL Library.
  5. Working with Mesh data in  QGIS

What is mesh data?

When it comes to Geospatial data most people only think of vector or raster formats. But what do you do when you working with data that can not be correctly represented in raster or Vector data format?

Mesh data is a hybrid data model that represents data in form of irregular grids that store several components such as temporal components and spatial components. Mesh consists of vertices(points) that are topologically connected to form edges. Several vertices connected will then form a face that can take the shape of any polygon. In QGIS mesh data is rendered using triangles or regular quads.

When to use mesh data?

Mesh data is suitable for the representation of data that contains multiple components in each location as each vertex can be assigned a different component. 

Mesh data is also suitable for the representation of data with temporal dimension as each vertex can have a temporal dimension. In visualization, the mesh data can display the temporal component of the data using a time slider in QGIS. Hence mesh data has become popular in applications such as hydrology, and meteorology. It is worth mentioning that using mesh data to represent many data points such as point clouds can be slow as everything is held in memory for various resolutions.

MDAL (Mesh Data Abstraction Library).

MDAL is to mesh data as OGR is to vector data and GDAL is to raster data. If you are not familiar with GDAL and are curious to know more go to this podcast episode. https://mapscaping.com/podcast/gdal-geospatial-data-abstraction-library/ 

MDAL is a C++ library that converts the mesh data into a structure that is recognized by your application such as QGIS. It comes built into the QGIS core so you can work with mesh data just like you would any other data format supported by QGIS.

MDAL supports two standards either fully or partially:

  • Climate and Forecast Metadata Conventions
  • Unstructured Grid (UGRID)

To understand more about MDAL and the community around it go to https://www.mdal.xyz/ 

Using Mesh Data in QGIS.

The assumption here is that you have worked with QGIS, but if you are new to it listen to this podcast to refresh your understanding of the software https://mapscaping.com/podcast/qgis-an-opensource-geospatial-project/ and also visit its official documentation.

To add mesh data to your QGIS environment go to Layer then click on Add Layer. The Mesh layer option will be shown as one of the data formats you can add to QGIS. When you select Add Mesh Layer you will get a window to navigate to your files.

Layer >Add Layer > Add Mesh Layer

We have added 10m wind speed data to our QGIS environment for East Africa, along the Indian Ocean Coast as shown above with the default display. This region experiences frequent cyclones and so Mesh data would provide a good way to visualize the wind patterns.

The display can be modified to fit your data characteristics. In the figure above, the mesh grids are rendered using the Native Mesh Rendering that shows quadrants but it can also be rendered using Triangular Mesh Rendering that displays triangles.

 To get the metadata for your mesh layer, use the properties tab.

On the Layer properties tab, you can change the display of the data, check mesh layer metadata such as coordinate system and switch to 3D view among other functions.

Additionally, you will notice that there is a clock icon on the mesh layer on the data layers panel indicating the temporal component of the mesh data. For instance, you can change the display to Contour which would then display the data as raster data where regions with higher values will be displayed in darker colors than areas with lower values.

To activate the vector data (Vector data in this case is not referring to the vector data format used to represent spatial data but rather the representation of the direction and magnitude of a property) click on the Vectors icon on the symbology panel. You can also change the appearance of the vectors by changing the values of their properties such as line width, line length, color, and transparency among others.

Mesh Data temporal component.

Click the clock symbol on the mesh layer to go to the temporal tab inside the properties dialogue box from which you can configure the layer temporal settings and time intervals. 

After changing the settings to fit the structure of your data go back to the map navigation toolbar and click on the clock icon to open the Temporal Control Panel. On the Temporal Control Panel click on the play icon to open the animation controls for the animated temporal navigation.

To set the time range to match the mesh dataset click on the refresh icon (set to the full range). You can then use the slider or the play button to view the changes in the phenomenon over time. If you want to add a label showing the current time frame on the map use the built-in title decoration tool. To open the title decoration tool Go to View >Decorations >Title Label.

Click the checkbox to enable it and click the Insert button and Expression button and enter the following expression to display the time. @map_start_time contains the timestamp of the current time slice being displayed. So we can use that timestamp and format it to display the time of occurrence. See the official QGIS Documentation for details on various supported formatting options for the timestamp.

If the animation is too fast, you can adjust the frame rate by clicking Temporal Settings (yellow gear icon) at the top-right corner of the Temporal Controller panel. Decreasing the frame rate (frames per second) will slow down the animation.

To create an animated GIF use the Export Map animation tool on the temporal control panel. This will export individual snapshots per hour(or per day depending on your set time interval) in .PNGs format. You can then use other tools like GIMP to create an animated display of the snapshots. 

More resources:

  1. https://mapscaping.com/podcast/qgis-an-opensource-geospatial-project/
  2. https://www.mdal.xyz/
  3. https://mapscaping.com/podcast/foss4g/
  4. https://mapscaping.com/podcast/pdal-point-data-abstraction-library/
  5. https://mapscaping.com/navigating-geospatial-open-source-a-guide-to-an-ogc-stack/
  6. https://docs.qgis.org/3.4/en/docs/user_manual/working_with_mesh/

Recommended Podcast Episodes Related To Mesh Data