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
1
vote
0answers
33 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
1answer
29 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(...
0
votes
0answers
32 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
1answer
59 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
2answers
92 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 ...
3
votes
1answer
71 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
2answers
112 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 ...
3
votes
1answer
122 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 ...
1
vote
1answer
41 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
0answers
38 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
0answers
46 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
0answers
22 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 ...
3
votes
1answer
72 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
1answer
37 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
1answer
41 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
1answer
53 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
1answer
57 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
1answer
32 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
2answers
190 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
1answer
122 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
0answers
59 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
3answers
291 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
1answer
39 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
2answers
123 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
2answers
67 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
1answer
75 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
1answer
155 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
1answer
79 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
1answer
84 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
1answer
107 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
3answers
126 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 ...
4
votes
1answer
207 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
0answers
26 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 ...
4
votes
1answer
38 views

Splitting Multipart geometries using Virtual Layer in QGIS

I have a Virtual layer already set up and working, the only thing that could make it better is getting rid of multipart geometries. The query is: SELECT ejido, circ, radio, mzna, cc, ten, ...
1
vote
0answers
40 views

QGIS Virtual Layers from DB query load as 'missing' when opening project file

I'm using QGIS 3.16 and I have a layer from a database query that loads as a table, 'Data_vFoodLocations'. I then created a bunch of Virtual Layers with queries like the one below: select FieldX, ...
5
votes
1answer
125 views

Virtual layer with spatial query crashes in QGIS

Working with QGIS 3.10. Details: This should be really simple, but I am unable to solve it: I've got a point layer with two numeric fields "max" and "min", and a polygon layer. I ...
4
votes
2answers
179 views

Connecting points with line in a specific sequence

I have 6 points in one layer as shown in the first image. I am trying to: connect points with lines in a required sequence. Save data of line connections (From_point and To_point) in the seperate ...
3
votes
0answers
144 views

QGIS 3.10 crashes constantly when performing join with virtual layer

I want to create a pie-chart map showing the amount of groundwater extracted from different aquifers within different administrative areas like in the picture below: I have a shapefile with ...
1
vote
2answers
44 views

Substracting attributes of different layers [closed]

Can I subtract two attributes belonging  to two different layers? In this case these would be two polygons holding DEPTH attribute (Depth1 - Depth2).   Is this possible and if so how?
10
votes
1answer
299 views

Listing all functions available in QGIS's Virtual Layer

How can I get automatically a list of all functions available for usage in QGIS's Virtual Layer? From my own understanding/experience and the QGIS Documentation, QGIS's Virtual Layer employes a ...
13
votes
3answers
621 views

Convert vertices of polygon features to points using Virtual Layer in QGIS

I have a polygon layer and want to use a Virtual Layer that creates points from the vertices of the polygon layer. The question is how to write a query that does this? I am aware of the tool "...
1
vote
2answers
245 views

QGIS: Comparing attribute values from different layers with Expression string builder

I want to compare attribute values from different attributes from multiple layers in the Expression string builder in QGIS (3.16.1) in of these layers, but I don't know how to do that. I've tried out ...
5
votes
1answer
142 views

Temporal nearest neighbour analysis in QGIS

How do I conduct a temporal nearest neighbour analysis in QGIS? Not sure if that's the right terminology, but basically, I have a dataset with ~100,000 house price transactions over a 5 year period. ...
3
votes
0answers
27 views

Adjusting buffer between arrows and both begin and end points separately [duplicate]

I'm currently making a map of the Netherlands in which the flow of student migrations upon or shortly after their graduation is depicted. Here's what I've made so far: I'm getting a bit more pleased ...
2
votes
1answer
25 views

Paste style to virtual layer from another layer

My virtual layer disappears when I paste a style from another layer. I've done this process before and it worked fine, so I'm not sure what the problem is now. Here are my steps: create virtual layer ...
3
votes
0answers
70 views

Manually adding centroids to arrows in Virtual Layers in QGIS

Currently, I'm making a map that depicts the migration flows of people who have finished their university degrees and decide to move to a different Dutch city after their studies. By following Anita ...
1
vote
0answers
41 views

Combine data and geometry from vector layers without merging

I have 3 line type vector layers representing municipal infrastructure; sanitary, storm, and water main pipes. Each of these layers should remain separate and all of these layers have different ...
2
votes
1answer
46 views

Creating Virtual Layer with only desired fields

My question is very similar to this one. The difference being I want multiple fields where they wanted only a single field. I'm trying to create a virtual copy of my layer with only the following ...
2
votes
1answer
156 views

Why is a (self) join so slow with Virtual Layer

I use QGIS 3.4 on Windows 10 I have a polygon layer and a point layer. The points have a streetname attribute. I want to check if there are polygons with more then 1 streetname. I took 2 steps, first ...
1
vote
0answers
86 views

Virtual Layer from SQL query is extremely slow

I have two layers, one is a grid of circles and the other is all Census Block Groups (CBG) in the state of Florida. I created a Virtual Layer out of this code SELECT CirclesFlorida.name, group_concat(...