Questions tagged [virtual-layer]
A QGIS vector layer that is a database view built using SQL over other QGIS layers.
153
questions
1
vote
0
answers
28
views
SpatiaLite ST_Transform does not return geometry in QGIS virtual layer
I am using the following query to SpatiaLite in a QGIS virtual layer but it is returning null geometries (looking to transform from ESPG:4326/WGS 84 to ESPG:27700/OSGB 1936):
SELECT st_transform(p....
3
votes
0
answers
51
views
Adding a Virtual Layer makes QGIS unresponsive but the test of the query says "No error"
As stated here, I am trying to load a virtual layer from two existing PostGIS tables, using a simple LEFT JOIN statement:
SELECT t.id, t.geometry
FROM table_t t
LEFT JOIN table_f f
ON f.fk_poly_id = t....
2
votes
1
answer
56
views
QGIS virtual layer: Query preparation error on PRAGMA table_info(_tview): no such column: t.poly
I am trying to load a virtual layer from two existing PostGIS tables, using a simple LEFT JOIN statement:
SELECT t.id, t.poly
FROM table_t t
LEFT JOIN table_f f ON f.fk_poly_id = t.id
WHERE fk_i_id = ...
3
votes
1
answer
47
views
Is there non spatial Virtual Layer in QGIS?
I have two users working on the same project with identical shapefiles but in a different geographic area.
User 1 is working in Area 1
User 2 is working on Area 2
When using MapInfo I used to keep ...
1
vote
1
answer
29
views
Reviewing query from which Virtual Layer was originated in QGIS
I created a Virtual Layer by going in Layer > Add Layer > Add or Edit Virtual Layer. This new layer was created by building a query on another layer I had in my project.
Ho can I check, ...
3
votes
2
answers
65
views
Merging/Dissolving multiple layers in QGIS Virtual Layer
I have several polygon layers that I would like to merge and dissolve within a virtual layer in QGIS. So that any changes made to the individual layers will automatically update in the merged/...
2
votes
1
answer
46
views
QGIS use "Move feature" for two layers with different geometry at once with attribute tables intact
I have 2 layers, which are placed separately, but they create the schematic. Hence their cooperation is highly essential. I've styled them in order to match the schematic requirements. Now I have the ...
4
votes
1
answer
76
views
Grouping lines by name and determining their proportions using Virtual Layer
I have a line layer with hiking trails. The hiking trails are divided into their surfaces. So one hiking trail consist of parts with different surfaces.
I would like to use a virtual layer to group ...
2
votes
2
answers
46
views
Connecting points by line number and code in QGIS
I am looking to connect points with a line using Geometry Generator or Virtual layer. Each point has a unique number, a code and a line number. The goal is to display in QField application the lines ...
0
votes
1
answer
68
views
Query SQL x Virtual Layer x Joined Fields
I am facing the following situation.
I have a spatial layer which I did a JOIN tool with a data table. Now in my attributes window I see all the fields: the original ones and the ones from the joined ...
1
vote
0
answers
25
views
How to select nearest feature with the same attribute on different layer in QGIS?
Introduction: I have two point data sets containing data about sites investigated using different methods, let's call them sites-original and sites-comparison. Each table has a field "method"...
5
votes
1
answer
65
views
Dynamic closest point with subgroups in unique layer in QGIS
I work in forest and I need to export plans for students. They have to designate some trees on field (a forest plot with all trees numbered) and I get a CSV list with the student's number, the tree's ...
5
votes
2
answers
212
views
Joining multiple layers in QGIS
I have about 25 GeoPackage files, each containing a table with an "ID" field and another with density information about that area. I want to join all those density information into one layer,...
4
votes
1
answer
105
views
How to deal with removing/disabling a virtual layer that makes QGIS unresponsive
I created a virtual layer and wrote an expression that I suspect was really heavy and returns a very large data set (I was playing around). After adding the virtual layer QGIS became unresponsive and ...
2
votes
1
answer
40
views
Automatically update Buffer Layer
I have recently started working with QGIS. Quite new to this software.
Anyway, my first task is to create contours from shapefiles using buffers, unions and dissolve functions. This shapefiles are ...
4
votes
3
answers
141
views
Creating difference of two polygon layers using Virtual layer in QGIS
I am trying to learn the usage of Virtual Layers in QGIS but I can't find a solution for a problem that seems very simple.
I have two polygon layers and I want to have the difference.
Polygon layer 1:
...
2
votes
0
answers
74
views
How to Multipart to Singlepart a QGIS virtual-layer?
I have a polygon layer I want to explode into single lines. I preferably wish to do so in spatialite since I work almost exclusively in QGIS DB-manager. No matter which function I use the number of ...
2
votes
1
answer
89
views
Calculating the angle of view from points to a polygon
This question Calculate field of view / angle of a point to a shapefile was attempting to achieve a similar outcome to my need (calculating the angle of view between observer locations and a polygon). ...
1
vote
1
answer
118
views
Aggregating point geometries and creating envelope using Virtual layer in QGIS
I am trying to group points using a Virtual layer and create a rectangle covering an extents but I cannot get it to return the geometry.
Current code is this:
SELECT
VP.Page,
st_envelope(...
1
vote
0
answers
34
views
How do I aggregate grouped point geometries with a fixed point in a virtual layer?
I am creating an atlas for viewpoints (point layer) looking toward a site (polygon layer, one feature only). Each page of the atlas must show the site and either 1 or 2 of the viewpoints. The ...
5
votes
1
answer
89
views
Creating Single sided buffer with Virtual layer in QGIS
I'm creating a layer with single sided buffers based on a line layer as virtual layer in QGIS with the following query:
SELECT
id,
ST_SingleSidedBuffer(layer.geometry, layer.buffer_dist, layer....
7
votes
2
answers
103
views
Creating subset of layer intersecting with BBOX of certain features of the same layer using Virtual Layer in QGIS
I'm trying to create a subset of one layer which includes the geometries intersecting with the bbox of certain features of the same layer.
I tried to create a Virtual Layer in QGIS with the following ...
4
votes
1
answer
100
views
"Duplicate column name" error when calculating length of shared boundaries between multiple polygons using Virtual Layer in QGIS
Similarly to the poster from this question, I am trying to calculate the length of the boundaries between several polygons. I have two types of polygons (1:blue and 2:pink), but I don't think that ...
5
votes
2
answers
206
views
Intersecting more than two layers at same time using QGIS
Background:
At 3.20.3, there are two intersect tools available: Vector > Geoprocessing tools > Intersection and Processing Toolbox > SAGA > Features - Polygons > Intersect.
In both ...
4
votes
1
answer
169
views
Creating integer and string fields in attribute table
I am trying to create a new attribute field "FromNode" in a layer that contains string with an integer.
EXAMPLE: name1, name2, name3, name4, ... till the end of the table.
I got the ...
2
votes
1
answer
67
views
Joining hub and spoke points by lines using Virtual Layer
I have two shape points as shown in image below.
Point 1 represents the connectivity nodes (hub)
Point 2 shows the address(spoke)
How to connect each hub (connectivity nodes) to nearest spoke(...
2
votes
0
answers
64
views
Virtual layers w/ spatial query not working as before (3.18.1 vs 3.20.3)
I have a set of maps that intensively utilizes virtual layers, but last week our boss updated from QGis 3.10/3.18 to 3.20.3 in all PCs, and now the layers are not loading.
Normally they would refresh ...
2
votes
0
answers
63
views
Distance between line and point with shared ID
I have a point layer and a line layer with matching ID fields.
I want to calculate the shortest distance between points and lines where the ID matches.
They are not always the closest features to each ...
1
vote
0
answers
27
views
QGIS Dynamic Virtual Layer as layer coverage of Atlas
Trying to optimize QGIS for my work, I tried to setup a dynamic virtual layer as a layer coverage of my atlas composition, using DB Manager. I join a vector file to a txt file to use one polygon as my ...
4
votes
1
answer
125
views
Selecting all features from two polygon layers in one Virtual Layer in QGIS
I have two polygon layers that partially overlap: buidings and plots. Each layer has 126 features.
I want to create a Virtual Layer that is simply an addition of the two layers, thus it should contain ...
3
votes
1
answer
51
views
Length of shared borders between polygons using Virtual Layers
I have a map with many counties, and I estimated the length of the common borders using one of the answers from this question posted a year ago.
The properties of my layer look like this:
I did the ...
2
votes
1
answer
51
views
Queries for subset sub-setted data spatially in Virtual Layer
I need to fiddle together some small but smart queries in a Virtual Layer.
I have a growing GPKG of field observations, and for easier analysis of the progress, I would like to create some queries in ...
2
votes
1
answer
58
views
Query for calculating length of lines inside polygon gives empty output [closed]
I am writing an SQL query to calculate the length of lines inside a polygon.
SELECT r.*, st_length(st_intersection(r.geometry,b.geometry)) AS Length_Inside
FROM Gen_Line as r, Buffered as b
WHERE ...
0
votes
1
answer
78
views
ST_azimuth creates only NULL values for Virtual Layer in QGIS
I have two layers with points representing two measurements of the same structure using two different methods. The points representing the same structure element have the same ID in both layer.
To ...
3
votes
1
answer
51
views
Polygon to Lines in Virtual Layer
Is there a way in QGIS to transform a Polygon layer (shapefile) to a Line layer through "Virtual Layers"?
In case there is how could I in addition to making the conversion also avoid ...
3
votes
2
answers
321
views
Area of each polygon that intersects another layer and total area of intersections in QGIS
I have two layers: 'A' (orange) and 'B' (purple).
Using a Virtual Layer and group_concat I am able to list the polygons in layer 'B' that intersect with those in layer 'A' thanks to @Jesse McMillan's ...
5
votes
1
answer
155
views
Disjoint is very slow in Virtual Layer but fast on symbology
In QGIS, take a polygon grid (named 'grid') and a multipolygon layer (named 'surfaces').
For each feature in surfaces, I want to union all features of the grid that are disjoint (not intersected) with....
0
votes
0
answers
99
views
Creating virtual layers using Python and export them without using QGIS UI
I am trying to create a flow map and have 5000 nodes and millions of edges. I've used
SELECT StartID, DestID, Weight,
make_line(a.geometry, b.geometry)
FROM edges
JOIN nodes a ON edges.StartID ...
5
votes
3
answers
378
views
Calculating overlap area that belong to each point in QGIS
I want to calculate the overlap area of buffered points in QGIS.
I have tried 'Polygon self-intersection' of the buffered points, but there is only 1 overlap area for each overlap.
For example in the ...
1
vote
1
answer
73
views
Create geometries from data-only tables using virtual layers
In QGIS 3.18, I have two data-only layers (csv) - the table coordinates containing lat/lon values, the table data containing attribute data. Both tables have a common unique id: 1 (data) : n (...
3
votes
2
answers
227
views
Counting points in each polygon so that points do not repeat QGIS
I have a points layer and a polygon layer.
I need to count points in each polygon/buffer so that points do not repeat. For instance, here is an example with 4 polygons and 8 points inside in total.
...
3
votes
2
answers
76
views
Creating line between point layer and line layer
My goal is to create a line layer that is derived from the distance between a point layer and a line layer. An example could be using a line layer representing a road and a point layer representing a ...
3
votes
1
answer
139
views
Summing values in Virtual Layer returns NULL
In a Virtual layer I'm trying to sum the values (real) on a table ('PESQUISA') but it returns NULL. What am I doing wrong?
This is the code I'm using:
select sum("renda_mensal") as sum
from ...
0
votes
1
answer
357
views
QGIS iface.addVectorLayer() results in incorrect field length
I ambuilding a python plugin for QGIS. As part of the plugin, I do:
iface.addVectorLayer(geoj, self.selectedLayer, 'ogr')
This is basically adding a layer to the project, with
geoj: a geojson string,
...
2
votes
1
answer
115
views
Query not working on Virtual Layer but working on the real layer
I'm using QGIS 3.10.10 because of project compatibility. I have the following issue with a query used to filter a virtual layer:
If I try to apply a filter to the layer INFRASTRUTTURE as follows:
...
2
votes
1
answer
106
views
Using Virtual Fields in Views in QGIS
I'm trying to summarize some information in a map layout in QGIS controlled by an atlas. I have parks, and connected to that I have objects within these park (points, lines and polygons).
I want a ...
5
votes
1
answer
110
views
Creating IDs for middle point of line
I have line layer as shown here:
I created middle point of line by using the below query in virtual layer.
SELECT ST_StartPoint(ST_Line_Substring(geometry, 0.5, 1))
FROM "TR_ROAD copy"
The ...
5
votes
3
answers
180
views
Generating start and end points for individual road segments
I have shape file with road network (line layer) as shown in Image 1. The road network contains multiple line segments as shown with blue line in image.
I am trying to generate start and end point of ...
5
votes
2
answers
321
views
Connecting points with line using virtual layer in QGIS
I have 10 points in QGIS layer as shown in Image 1.
I am trying to connect points with lines in required sequence as shown in Image 2. However, when I tried to connect all points with virtual layer, ...
0
votes
0
answers
34
views
Wrong vector selected mouse-clicking on computed layer
[qGIS 3.10.14]
Only on computed layer such as virtual or spatialite view:
When simply clicking in canvas (or using any other gui/spatial selection method) to select particular feature(s), what gets ...