Virtual Layers in QGIS

Virtual Layers in QGIS

Table of Contents

In a GIS project, there are so many data formats one can use for their analysis. Depending on the data available for your project, one can leverage the power of QGIS to extract meaningful pieces of data for their analysis. As defined in the QGIS documentation, virtual layers in QGIS are created as a result of a query using the SQL language, simple or complex. This query can be conducted on various vector layers that are supported in QGIS (or basically can be opened in QGIS).

Virtual layers are basically views representing other layers in a GIS. You will manage to open the attribute tables, carry out geoprocessing on them, and export them without limitations.

One other thing to note with virtual layers in QGIS; virtual layers persist after the project closes. Unlike the temporary scratch layers, these layers persist.

Practical Examples

As shown in the figure below, a virtual layer has been created from the polygon dataset (Ken_Adm2) to represent one of the regions within the country (virtual_layer_rift_valley).

Virtual Layers in QGIS
A screenshot of virtual layers in QGIS

In the image above, the highlighted region exists as a separate layer which is a result of an SQL query.

In QGIS, just like any other vector layer, the outputs of the SQL query(the virtual layer) can be used for analysis. In the example shown below; creating a virtual layer from schools using the first virtual layer as the overlay area.

Virtual Layer in QGIS based on location
Creating a virtual layer based on location

As shown in the image above, a filter has been applied to the schools layer. All schools that fall within the area shown above have been filtered. When creating virtual layers in QGIS, there are quite a number of functions that one can utilize in writing queries. Since spatial queries are just like any other database queries, it makes them easy to write and implement.

Tutorial

To explore more about creating virtual layers in QGIS, here’s a quick tutorial.

For questions, leave a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 − eight =

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Wanjohi Kibui

A GIS user with interests in web and desktop systems development, FOSS advocate, trainer and mentor. Lives in Nairobi but finds adventure in travelling. The "Life in GIS" phrase is as a result of the many told and untold stories in the Geospatial realm.

More Reading

Post navigation