Questions tagged [virtual-layer]
A QGIS vector layer that is a database view built using SQL over other QGIS layers.
228 questions
0
votes
0
answers
45
views
QGIS Virtual Layer not working
When I create a virtual layer, my SQL code needs to allow for the summation of an entity's surface area based on a condition applied to another field of the same entity. This condition is expressed in ...
1
vote
0
answers
51
views
Virtual Layer Returning one attribute record with 1:many relationship query
I have 2 tables in a geopackage with a 1:many relationship:
-- parent table
CREATE TABLE "str_pt" (
"fid" INTEGER NOT NULL,
"geometry" POINT,
"...
0
votes
0
answers
72
views
Form Value Relation field return Filtered value from Virtual Layer (PostGIS-based) using QGIS
I am using QGIS 3.42.1.
I have a virtual layer consisting of a join between 3 PostGIS tables to connect a customer with a location.
location_customer_address:
SELECT a.location_name,
c....
2
votes
1
answer
146
views
Contour label positioning on ridges and waterlines
I find the normal possibilities for label placement on contour lines aesthetically chaotic. I would like to have a way to place the labels on the ridgelines and waterlines.
I have done manual ...
1
vote
1
answer
76
views
QGIS Virtual Layer - Create equal length segments like with PostGIS ST_Segmentize
I was puzzled to find that the st_segmentize function is not available to QGIS Virtual Layers. Is there a workaround? I need to split my line into equal length segments, like with
st_segmentize(...
3
votes
0
answers
86
views
Virtual Layer version of QGIS' Split with Lines tool
As I'm already aware, QGIS 3.30+ has a built-in "Split with Lines" tool. However, a variant specifically tailored for the SQL Virtual Layer system, particularly one built around the ST_Split(...
1
vote
1
answer
126
views
QGIS virtual Layer joins setting
Using QGIS, I´ve created a point geopackage layer (punkte_gnss) and two virtual layers (pGNSS_vL_PvDW,pGNSS_vL_CircleIntersect). Both with separate expressions and symbology/textstyling. But both with ...
2
votes
1
answer
117
views
Converting vertices of lines features to points with elevation and steepness with QGIS Virtual Layer
I am looking for a very similar solution to the one for polygons but for a simple line layer and with some additional data included on the points:
elevation from a DTM (available as a layer in the ...
0
votes
0
answers
61
views
Virtual layer combined with x layer in group (QGIS)
Is it possible to combine a virtual layer with a layer in group? For my project:
I create a group "A"
place a point layer "A"
place a virtual layer "A" with a little ...
1
vote
0
answers
53
views
QGis CRITICAL Layer vlayer (virtual layer)
While export offline with QField sync I´m getting follow error:
CRITICAL Layer vlayer : Error while executing feature count request : Query preparation error on SELECT Count(*),Min(MbrMinX("&...
-1
votes
1
answer
130
views
QField Error on virtual layer
I´ve build a little project with a point layer and a virtual layer. I´ve import the layer from the procet to the virtual layer and add some code. This will create a buffer zone around my point layer. ...
4
votes
1
answer
472
views
Virtual layer from CSV
I keep getting "Referenced table C:\Users\IA\Documents\QGIScsvtest1.csv in query not found!" fault message when trying to read a CSV.
I go to create a virtual layer (I want to keep the CSV ...
1
vote
1
answer
96
views
Extract by location and attribute or two attributes
I have a geopackage with 25 million points and the little laptop that could. The attribute table has a speed and a location identifier for each point. We can call the fields "Speed" and &...
3
votes
2
answers
221
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 ...
4
votes
1
answer
128
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 ...
0
votes
0
answers
64
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 ...
3
votes
1
answer
265
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 ...
0
votes
0
answers
120
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'...
0
votes
0
answers
71
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 ...
2
votes
1
answer
85
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
...
3
votes
1
answer
292
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
4620364,...
3
votes
1
answer
150
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 ...
2
votes
1
answer
38
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 ...
1
vote
0
answers
92
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 ...
3
votes
0
answers
138
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 ...
1
vote
1
answer
87
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 ...
3
votes
1
answer
97
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 ...
1
vote
1
answer
54
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 ...
1
vote
0
answers
59
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 ...
3
votes
0
answers
116
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 ...
5
votes
1
answer
298
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 (...
3
votes
0
answers
334
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 ...
3
votes
1
answer
349
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 ...
2
votes
2
answers
171
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 ...
3
votes
1
answer
372
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....
2
votes
1
answer
80
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 ...
2
votes
1
answer
457
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 ...
2
votes
1
answer
428
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 ...
3
votes
1
answer
78
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 ...
2
votes
1
answer
192
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, ...
1
vote
1
answer
150
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
18880033
0
...
5
votes
2
answers
291
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 ...
3
votes
1
answer
213
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, ...
1
vote
0
answers
61
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 ...
1
vote
1
answer
183
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 ...
4
votes
2
answers
273
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 ...
2
votes
2
answers
349
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 ...
2
votes
0
answers
84
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 ...
0
votes
1
answer
60
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 ...
1
vote
0
answers
178
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 ...