Skip to main content

Questions tagged [virtual-layer]

A QGIS vector layer that is a database view built using SQL over other QGIS layers.

Filter by
Sorted by
Tagged with
3 votes
2 answers
105 views

Changing values where two geometries are equal otherwise keep value with QGIS Virtual layer

I have two line layers in QGIS, of which one layer (layer 2 - yellow in the image) is a geometrical subset of the other (layer 1- blue in the image). The two layers also differ in their values of a ...
i.i.k.'s user avatar
  • 1,753
4 votes
1 answer
57 views

QGIS Virtual Layer Query containing JOINS always ends up having zero results

I've got a problem JOINing together several PostGIS tables (with or without geometry) in a Virtual Layer in QGIS 3.36.3 As soon as I use a (inner) join the the layer query statement, the result set is ...
Tom's user avatar
  • 53
0 votes
0 answers
37 views

Create distance buffer for virtual layer with categorized symbology QGIS 3.34

I want to create a virtual layer with a fixed buffer distance e.g. 1000 m from a buliding layer as input. The building layer contains information about its use in colum X of its attribute table. The ...
Kevin_S2021's user avatar
3 votes
1 answer
131 views

Filtering subset of records to be used in subsequent SQL statements

I recently posted this question, where the answer involved SQL and a Virtual Layer. In that situation, the SQL acted on the entire input layer, with the output exactly as desired. Now I would filter ...
Stu Smith's user avatar
  • 8,190
0 votes
0 answers
40 views

QGIS 3.34.5 LTR Virtual layers Crashes

Migrating from 3.28 to 3.34.5 I have a virtual layer that is causing crashes. I am using a virtual layer to union 3 layers together to simplify the number of layers. I have simplified the layer and it'...
Sethinacan's user avatar
  • 1,726
0 votes
0 answers
26 views

Create virtual layer out of three tables

I have a problem with creating a virtual layer. The issue is from a bad Database where the line geometry id is linked to non-geometry tables where the other information is included. In case this is a ...
Gafzgarrr's user avatar
0 votes
0 answers
31 views

Adding a virtual layer leads to slow perfomance and crashes in QGIS 3.36.1

I am creating a QGis project to help us track regular visits to specific properties in a small area. In order to do that I have the property cadastre layer which contains around 10000 individual ...
Cristian's user avatar
2 votes
1 answer
54 views

How to create a Virtual layer with point geometry and count repetitions from 3 different tables [closed]

From 3 tables with the following fields: PARENT_TABLE CODE1 CODE2 XCOORD XCOORD 12395 8604813EG7180S0001GX 418477,91 4620364,53 13505 8604813EG7180S0001GX 418477,91 4620364,53 12968 ...
Acperience's user avatar
  • 1,142
3 votes
1 answer
146 views

How to create a Virtual layer with point geometry and count repetitions

From a table with the following fields: CODE1 CODE2 XCOORD YCOORD 162 6605548EG7180N0001SF 418596,65 4620206,74 196 6604802EG7180S0001SX 418477,91 4620364,53 196 6604802EG7180S0001SX 418477,91 ...
Acperience's user avatar
  • 1,142
3 votes
1 answer
105 views

Generate dynamic sum of attribute values from one layer based on overlap with polygons on another layer

I'm using QGIS 3.28 on Windows. I'm trying to make a workflow for determining whether a proposed lot satisfies minimum lot sizing based on soil type composition. I have: a single-polygon overall ...
dsjeffery's user avatar
2 votes
1 answer
24 views

How do I use SQL and virtual layer to draw a line from one polygon to another in the same layer?

Background: Sometimes in modelling hydrology (e.g. in SWMM) we have runon from one subcatchment area to another. These subcatchments are records in a shapefile. I want to show this situation as a line ...
Michael Kitchen's user avatar
1 vote
0 answers
69 views

ST_Project in QGIS Virtual layers or SQL Query

Is there an equivalent to ST_Project that I can use for an SQL query for a virtual layer in QGIS https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html ST_Project( start_point Geometry, distance ...
Sethinacan's user avatar
  • 1,726
3 votes
0 answers
76 views

Translate Geometry generator expression into Virtual layer Query

I have some expressions for drawing tree canopy zones ultimately I want to merge the zones for trees, hedges and woodland together but for now I would be happy if I can get the following expression to ...
Sethinacan's user avatar
  • 1,726
1 vote
1 answer
50 views

How to add a virtual layer using ST_ClusterDBSCAN function

I have a 'POINTS' layer with 74 points geometry with the fields "NAME" and "ID". I want to add a virtual layer with the following query to calculate the clusters using the DBSCAN ...
Acperience's user avatar
  • 1,142
3 votes
1 answer
56 views

Calculate area of polygons from one layer within polygon of second layer while matching criteria using virtual layers or field calculator QGIS

I have a polygon layer with classifications ('class'), and a second polygon layer of area of interest ('AOI'). I am trying to calculate the area of each of three classes within each (overlapping) AOI ...
Brian Fisher's user avatar
  • 1,133
1 vote
1 answer
28 views

Select by Location on Virtual layer works but not on MS SQL Server layer

I have point data within an MS SQL Server. I can add it as a layer to QGIS by creating a DB connection under MS SQL Server and double clicking the table listed. I also have a polygon layer again added ...
James Bourne's user avatar
1 vote
0 answers
42 views

Specifying field type as DateTime when exporting (save feature as...) QGIS virtual layer

To extract useful data from CSV file I use virtual layer. As virtual layer are based on SQLite all field in my virtual layer are of type int, real or text. These data need to be exported in an ESRI ...
J.R's user avatar
  • 16.6k
3 votes
0 answers
60 views

Updating Virtual Layer by PyQGIS

I want to update a virtual layer using PyQGIS by modifying the layer name in the query. Although I have executed the following code, the virtual layer's query remains unchanged when I open the project ...
user234164's user avatar
5 votes
1 answer
134 views

Virtual layers query returning blank layer with ST_intersection

I am trying to create a virtual layer in QGIS that is the intersection of two polygon layers, "Cowardin" and "Wetlands". Both layers are in the map canvas in the same projection (...
Brian Fisher's user avatar
  • 1,133
3 votes
0 answers
166 views

How to use ST_LineMerge or ST_Union to merge lines in QGIS virtual layers

If have an input layer with a couple of lines, called Line with an attribute. I would like to have a virtual layer with alle connecting lines dissolved, regardless of the attribute. input: expected ...
Beni's user avatar
  • 356
3 votes
1 answer
109 views

Save virtual layer for use in another project in QGIS

I created a simple virtual layer in QGIS, combining a couple of points from a polygon layer with vertexes from a polygon layer. I would like to export that virtual layer to be used as dynamic virtual ...
Beni's user avatar
  • 356
2 votes
2 answers
85 views

QGIS & PostGIS STRING_AGG in virtual layer definition returns "no such function: STRING_AGG"

i've defined the following SQL statement in the query editor of qgis' db manager: select sd.fk_polyg, count(sd.fk_polyg), STRING_AGG(DISTINCT sl.typ, ', ') as concat_typ from schaden_stein_detail as ...
robert tuw's user avatar
3 votes
1 answer
166 views

QGIS Speed up slow virtual layer

In QGIS I have a virtual layer which does a line generation based on a point shape. The point shape has about 700 point geometries and 26 attribute fields. SELECT a.Name, a.FromNode, a.ToNode, a....
MtoK's user avatar
  • 61
2 votes
1 answer
63 views

Unexpected behavior when creating Virtual layer using PyQGIS

I have already viewed this link and still having issues - Creating Virtual Layer with PyQGIS. When I create a virtual layer from the Layer -> Add/edit virtual layer and use this as a query it ...
heckubiss's user avatar
2 votes
1 answer
206 views

Is there a SpatiaLite equivalent to PostGIS' ST_DumpPoints? [duplicate]

I've been using PostGIS' ST_DumpPoints to 'explode' multipolygon layer into points with its corresponding polygon part, ring and index information. As QGIS uses a SpatiaLite engine against its Virtual ...
EranGeo's user avatar
  • 1,182
2 votes
1 answer
184 views

Speed up performance of virtual layer based on GeoPackages in QGIS

I am trying to use a virtual layer in QGIS (3.30) to add a region field to a suburb layer, by locating the centroid of the suburb within a region. The general approach is taken from: Spatial join ...
Tom Brennan's user avatar
  • 5,249
3 votes
1 answer
50 views

Get spatial endpoints grouped by attribute via virtual layer

I have a set of lines consisting of several single object LineStrings. These line can be collected to routes by attribute, e.g. a street consisting of multiple lines from crossing to crossing, but ...
e-shirt's user avatar
  • 667
2 votes
1 answer
122 views

Adding a new column with value in a virtual layer query

I've created start and end points from a LineString layer using this answer from another question: select id, sts as route_id, st_endpoint(geometry) as geometry from pointclasstest union select id, ...
e-shirt's user avatar
  • 667
1 vote
1 answer
108 views

Create e virtual layer (points to line) refering to specific rows in attribute table

I have a point layer "Points" with the following attributes: Name FromNode ToNode Startheight Gradient Length Endheight 14870040 14870040 14870055 39 0.005 57.51 14870056 14870056 ...
MtoK's user avatar
  • 61
5 votes
2 answers
219 views

Ordering points when making line in QGIS Virtual Layer

I've got a QGIS point geometry layer with four point features and a numeric field sequence. I want to create a virtual layer joining these points into a line geometry layer (which will have one ...
Spacedman's user avatar
  • 65k
3 votes
1 answer
85 views

Creating script to automatically create virtual layers with alphanumeric labels for shapefile grids in QGIS

I have many grids in shapefile format. Adding alphanumeric labels to them can be done through using a virtual layer SQL query as found in this thread: Creating GRID with customized labels in QGIS, ...
Bryce01's user avatar
  • 33
1 vote
0 answers
32 views

Raster pixels to vector points with virtual layer in QGIS

I would like to create vector points for each pixel of a raster that is located in polygon, using a Virtual layer. Details : I have 2 layers: P : vectors layer of polygons R : raster with value in ...
zlikotp's user avatar
  • 24
1 vote
1 answer
116 views

Virtual layer zonal statistic of raster using polygons in QGIS

I would like to create a virtual layer that creates polygons and make some raster zonal statistics in the geometry of these polygons. The aim is to use the polygons geometry to analyze pixel values of ...
zlikotp's user avatar
  • 24
4 votes
2 answers
210 views

Create singlepart polygons with several polygons in virtual layer QGIS

I would like to automatize the creation of several singlepart polygons when polygons (from layer Polygons) are crossed by a the same polyline (from layer polylines), and fill the gap between like ...
zlikotp's user avatar
  • 24
2 votes
2 answers
152 views

QGIS SQL syntax for GeoPackage layer in virtual layer

I'm trying to create a virtual layer in QGIS for use in QField using SQL, but cannot work out what the syntax is to refer to a GeoPackage layer. My GeoPackage is named "survey". My ...
Oisin's user avatar
  • 1,836
1 vote
0 answers
56 views

Is it possible to use zonal histogram or equivelent with virtual layers

I am trying to extract the areas of several land cover classes within a buffer polygon, and want them to change when the underlying polygons are edited. My current work flow is: edit polygon buffer ...
Brian Fisher's user avatar
  • 1,133
0 votes
1 answer
25 views

Partial raster dataset substitution workflow with virtual raster

I have scripted a workflow in ArcGIS Pro where a set of rasters gets some new data for certain areas, which is updated by building a Mosaic Dataset where the new rasters are layed on top of the old ...
MoritzMoreira's user avatar
1 vote
0 answers
92 views

Virtual layer in QGIS from generated geometry by a multi table join

I have a Spatialite database with three tables. I'd like to draw a center point of a line (by using ST_Line_Interpolate_Point) that is generated by a multi table join. The first table has the ...
Pixelfahnder's user avatar
3 votes
3 answers
640 views

Checking overlapping points from different layers in QGIS

I have a map with many layers, each one of them showing multiple points for different cities. For some locations, having the same lat and long data, these points are overlapping, being on top of each ...
Catalin Alexa's user avatar
1 vote
1 answer
105 views

Virtual layer accessing virtual field

I have a layer my_layer containing a virtual field virtual_1. Next step I want to create a virtual layer, which list only unique values (as a bonus also dissolves the geometries by unique values). The ...
gissurfer's user avatar
5 votes
1 answer
357 views

How to create a Virtual Layer using the QGIS Modeler?

At 3.28.4, I am trying to automate a series of manual steps using the Model Designer. One of the manual steps that I would like to automate uses the Layer > Create Layer > Create Virtual Layer ...
Stu Smith's user avatar
  • 8,190
2 votes
1 answer
81 views

QGIS - Let atlas iterate through distinct values of virtual field

I have a CSV-Layer with multiple columns (e.g. ID, owner_name) and well-known text data to contain information about polygons. One ID can be owned by to owners which would cause the feature to appear ...
gissurfer's user avatar
7 votes
2 answers
411 views

How to create a QGIS Virtual Layer that retains the source field types?

In a previous question that I posted, the answer that I accepted involved creating a Virtual Layer from a source layer. The query used to create the Virtual Layer was: select * from my_layer ...
Stu Smith's user avatar
  • 8,190
4 votes
0 answers
110 views

Create a virtual layer with a project variable defining the source layer(s) using QGIS

I would like to create a virtual layer where the source layer can easily be changed by editing the value of a project variable. Something like: SELECT * FROM var('active_layer') I found this post at ...
oekoplaner's user avatar
5 votes
1 answer
121 views

Using eval function in Virtual Layer in QGIS

I'm now trying to use the eval() function in a Virtual Layer in QGIS. The version of QGIS is 3.28.4-Firenze, and it contains the SpatiaLite (version 5.0.1) which includes the eval() function as below. ...
Lc_decg's user avatar
  • 137
5 votes
1 answer
305 views

Creating virtual layer with extent of features from multiple layers in QGIS

I am trying to create an atlas that shows a series of plots (polygons) along with the access routes (line features). I need to vary the extent to show the entirety of each site along with the access ...
Brian Fisher's user avatar
  • 1,133
1 vote
1 answer
88 views

QGIS does not find existing column when drawing lines between two point layers

I have two layers containing points. I want to draw lines from each point of layer Quellen to each point of layer Ziele. Layer Quellen has an ID called q.id, Layer Ziele has an ID called z.id. I have ...
e-shirt's user avatar
  • 667
4 votes
1 answer
67 views

Virtual Layer query connection failed at reload project

I have a QGIS project that generates a layer with point geometry from a database (Excel sheet) that I load directly into QGIS. To this table a join is established with a common field of a GPKG point ...
Acperience's user avatar
  • 1,142
1 vote
1 answer
308 views

Multi buffer from the virtual layer

I want to write a command that creates a virtual layer for me as a buffer from lines with different distance parameters, for example 5 and 10 km. I want this to be possible in one layer, the geometry ...
Łukasz Maćkiewicz's user avatar
1 vote
0 answers
145 views

Formulating a PostGIS query as data-source for a virtual layer in QGIS

While this seems to be an obvious application of virtual layers, I could not find a full description anywhere how to achieve it: I want to create a virtual layer that contains the results of a ...
larsg's user avatar
  • 11

1
2 3 4 5