Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [virtual-layer]

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

2
votes
1answer
67 views

Difference between JOIN ON and WHERE in Virtual Layers in QGIS

There is already a question on this topic Difference between SpatialJoin with “…where…” and “join…on…”. However, it is dedicated to PostGIS. Since in the Virtual Layer query window, I cannot simply ...
3
votes
2answers
155 views

Virtual layer functionality does not seem to support memory layers

I have a memory layer loaded in the QGIS virtual layer in the data source manager. I am trying to run a very simple query: select * from layer Here is a snapshot: While this works for the physical ...
1
vote
2answers
41 views

write z-value from polygon layer to point layer in QGIS

I have two layers: 1 polygon layer where the depth of an area is written in the database (as DRVAL1) and and where the depth is exported as a Z-value to the geometry. 1 point layer that I use to plan ...
0
votes
1answer
64 views

Preserving geometry with Virtual Layer in QGIS 2

There is a polygon layer "Union23" that was created with 'Union' tool. Layer's attribute table includes the following values. My effort is simply to aggregate those polygons by "FLAECHEID" field ...
2
votes
1answer
47 views

Add virtual layer to aggregate feature

newbie here of QGIS here, I was trying to aggregate a feature from a CSV with no geometries. The query is very basic: SELECT "PROV", SUM("POP_2012") AS POP_2012 FROM "municipalities-tuscany" ...
2
votes
1answer
64 views

UNION two LEFT JOINs as Virtual Layer in QGIS

In QGIS 2.18, there are two layers, e.g. "Locations" and "Connections" "Locations" has values Id | Dimension --------------- 1 | 4 2 | 8 3 | 2 "Connections" maintains attributes ...
4
votes
1answer
101 views

Select all columns except geometry using virtual layers

Is it possible to select all columns except geometry using virtual layers in QGIS? For example I have this (simplified) query: Select *, st_buffer(geometry, 100) From mypolygons It does not work. ...
3
votes
0answers
57 views

QGIS Server Adding a virtual layer

All my layers in the qgs-project-file are working fine as WMS-layers, but I only can't provide the virtual layer. The virtual layer is an ODBC-Connection of an Access-Database which contains one ...
1
vote
2answers
116 views

Creating a fixed distance buffer from a virtual layer

First off, i'm trying to learn some python to automate scripts for basic tasks i carry out in QGIS (2.18). Below I create a virtual layer (polyline) using the following script: from qgis.core ...
3
votes
1answer
99 views

Extending a segment in QGIS to check intersection with a polygon

I am trying to find the adress points (red dots) located in front of an obstacle (red polygon). The street is green and the pink line represents the street face (Si). This is what I have so far, but ...
2
votes
2answers
128 views

Calculating point layer values within polygon features in QGIS 2

There are two layers polygon BereichBerechnung with a field "Are_Number" points EW2017 with a field "EWjeAdr" In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr" for ...
1
vote
1answer
147 views

Efficient intersect query for virtual layers in QGIS

I have 3 tables/shapes as follows: ADRR (adress points) ADRR_ID | ST_ID (street surface id) | point geometry STREET ST_ID | ST_NAME (street name) | polygon geometry Obstacles ID_OBS | ...
2
votes
1answer
171 views

How to speed up a query in a virtual layer of QGIS?

I'm trying to speed up a query in a virtual layer. I noticed that the query runs at the same time for a partial extension and full extent of the layer shown on the map. So I thought if I filtered the ...
1
vote
1answer
59 views

QGIS Custom Python Function to Return Current Extent QGIS 2.18LTR

Related Question Charts and Graphs that only display features in current extent Trying to write a custom function to return the current view extent. The below code is what I wrote based on the QGIS ...
1
vote
0answers
23 views

Extract ordered point coordinates from polygon layer via Virtual Layer or PostGIS View

I have polygon layer and I need to create table with XY coordinates for each polygon staring from farthest to west (lowest value of X). Now I have Virtual Layer with SELECT ST_DissolvePoints(geometry)...
3
votes
1answer
62 views

How to load polygon layer with single field as virtual layer?

I have a polygon layer with 3 fields (A, B and C). I want to create a copy and add as a virtual layer so I use CREATE VIRTUAL LAYER option but only want the first field. So I use the expression ...
2
votes
0answers
173 views

Unable to show geometry in virtual layer qgis

I'm trying to create a virtual layer starting from a municipality layer and from a table of attributes, both stored in a Postgresql DB. So I've done a join like: *SELECT munic, country_of_origin, ...
1
vote
0answers
102 views

Is it possible to add an atlas variable to the SQL query when creating a virtual layer?

I'm trying to do something like this: select * from table_a inner join table_b on table_b.fid = table_a.id and table_b.code = @atlas_featureid I have tried this using QGIS 2.18.16 and QGIS 3.0 ...
1
vote
0answers
341 views

Clipping Virtual Raster in QGIS 3 [closed]

I have generated a virtual raster out of a large number of tifs but I am only interested in an area so I want to clip it. When I do it, it saves a raster file of several Gb. I would like to clip the ...
1
vote
1answer
529 views

Spatial Query for a Virtual Layer

I would like to use SQL to create a virtual layer in QGIS by clipping information from a large data set using a bounding box around my study area. I have two questions. Is this an efficient way to ...
5
votes
2answers
567 views

Keep virtual layer up to date

I have a virtual layer in QGIS with a query on a csv. The csv gets updated regulary. I need the max/min attributes in the virtual layer to be updated as well. The virtual layer is used as a title in ...
1
vote
1answer
177 views

QGIS: alternative to add/edit virtual layer. With python?

Following a previous question (Select polygons with other polygons layer?), I select some polygons using the query in the answer to create a virtual layer: SELECT greens.* FROM greens, purples WHERE ...
2
votes
1answer
133 views

Query and export a grouped subset of fields from a shapefile layer

I have several shapefile vector layers that I need to query so I can group records and export a subset of fields to go into an excel spreadsheet. I thought I could do this by using the graphical ...
2
votes
2answers
195 views

Getting nearest line to point with virtual layer using QGIS?

I have a streetmap and the position of hundred sensorlocations. I am currently trying to calculate the nearest line for each point. I have already done it with the nnjoin plugin. But now I want to do ...
1
vote
1answer
127 views

How to iterate nearest polygons until threshold is reached?

I have a point layer and a polygon layer (representing buildings). I created a buffer around the points and extracted those polygons which intersect the buffer. The points contain an attribute with ...
3
votes
0answers
260 views

Virtual layer from query with special characters in field name using PyQGIS

I have a layer loaded from a WFS server that contains fields with æøå in some of the names. I am making SQL queries to make virtual layers from this layer, but whenever I query a field with æøå in its ...
2
votes
0answers
174 views

Virtual Layers Clipping and Large Data Sets in QGIS

When working with large vector data sets in QGIS is there a method where you can ask QGIS to only load a small subset of your data? I know that this can be done based on attributes using a virtual ...
3
votes
0answers
117 views

Identify Results form for virtual layers in QGIS keeps displaying wrong feature

When I load up a virtual layer and I use the Identify Results tool, it will display the correct information in the Identify Results panel, but in the feature form popup it will always display only the ...
7
votes
2answers
401 views

In QGIS is it possible to apply an expression to a join

I am trying to join by 2 text fields and there is a lot of mismatch due to CaSe and space issues... can it be run so that it's lower("field1")=lower("field2") I otherwise have to create a new field ...
2
votes
0answers
181 views

Using WFS layers in Virtual Layer crashing/too slow QGIS

I am trying to create a virtual layer with the following code, where the layers are provided by a WFS: select geometry from ( select geometry from "Ancient Woodlands (England)" union all select ...
5
votes
1answer
416 views

Can't export geometry generator styling to DXF - alternatives?

I've been using QGIS' wonderful geometry generator to dynamically generate root protection zones and crown areas for some tree inventories I've been working on. It's been a massive time saver. ...
1
vote
0answers
78 views

QGIS virtual layer: Linear referencing result with gaps

I have a layer with some roads, and a table, with information of whether the road is paved or unpaved. The table contains linear referencing measurements from (vanpos) - to (totpos). I'm using a ...
5
votes
0answers
95 views

Selecting minimum number of neighbouring polygons required to give a fixed total area

I have a polygon layer. I would like to select the minimum number of neighbouring polygons to give a total area greater than a fixed value. In reality the polygons are land parcels and I would like to ...
4
votes
1answer
596 views

Creating virtual layers using the processing toolbox

A few days ago Cy T posted an interesting question about creating virtual layers using the Python console: Creating new Virtual Layer programmatically in QGIS? Is it also possible to create virtual ...
1
vote
0answers
52 views

QGIS Virtual Layers based on WFS fail to load on re-opening project

I have created virtual layers that use WFS layers as one of their sources. Usually, it is an intersection between the WFS layer and a local polygon layer. I embed all the sources. However, when I ...
2
votes
1answer
370 views

How to save a virtual layer (from a filtered join) with features from original layer in QGIS?

To be specific, I have a shapefile on census block groups (CBGs) in Georgia, but I only want to use those in Atlanta's commuting zone (CZ). However, commuting zone is not a field in the census ...
8
votes
2answers
2k views

Creating new Virtual Layer programmatically in QGIS?

Is it possible to create a Virtual Layer through a python script. For example, I have a layer "road", and I would like to perform sql " SELECT * FROM road WHERE type = 'Expressway' " Will this be ...
1
vote
1answer
155 views

How to get QgsFeatureRequest in a virtual Layer?

I am wondering if/how PyQGIS can intercept the QgsVirtualLayerProvider::getFeatures() requests of a VirtualLayer, and pull out just the spatial extent from the QgsFeatureRequest to dynamically ...
3
votes
1answer
237 views

How to include layer names when union'ing in virtual layers?

I am creating a virtual layer in QGIS using the following statement: SELECT * FROM ( SELECT * FROM a UNION ALL SELECT * FROM b UNION ALL SELECT * FROM c ) AS merged_tables What is the best way to ...
5
votes
1answer
492 views

What spatial functions are available to shapefiles as “virtual layers” in QGIS DB Manager?

Can anyone provide a list of the spatial functions available in the QGIS DB Manager plugin when using shapefiles as Virtual Layers? I've been trying to use things like ST_DWithin and even ST_Buffer ...
3
votes
1answer
1k views

How to update SQL query for a virtual layer?

I created a virtual layer which contains all the geometries and attributes from a shapefile using the following code: vlayer = QgsVectorLayer( "?layer=ogr:path/to/shapefile", "layerName", "virtual" ) ...
5
votes
1answer
408 views

QGIS “Execute SQL” don't accept more than 1 input table

I have some problems using the "Execute SQL" algorithm (in General Vector Tool) in the Processing Toolbox. No problem when I've got only 1 input table, but when I try to select 2 tables as input data ...
3
votes
2answers
410 views

Getting concatenated attribute values from Spatial Join

How can I query polygon features that intersect other polygon features in QGIS? I have ZIP code areas and city areas, and I would like to list all the ZIP codes that intersect the city areas. Example:...
7
votes
1answer
641 views

How to create dissolved buffers using QGIS virtual layers?

To create dissolved buffers (single geometries) in PostGIS I use ST_Dump and ST_Union: SELECT row_number() over() AS gid, sbqry.* FROM ( SELECT (ST_Dump(ST_Union(ST_Buffer(...
2
votes
1answer
180 views

QGIS virtual layer path never saved as relative

When I try to use virtual layers in QGIS, I'm unable to use relative paths. I've already set in the "Project Properties", in the tab "General", the "Save paths" as relative. You can see a ...
10
votes
2answers
991 views

Polygon intersection using QGIS virtual layers

I'm trying to intersect polygon geometries in QGIS by using a virtual layer: SELECT sbqry.rowid AS gid, sbqry.geom FROM (SELECT ST_Intersection(land_parcels.geometry, flood_zone....
6
votes
3answers
1k views

Is there a way of labeling the number of points with the same coordinates?

After reading through the following question (which is kinda related but not quite what I need): How can I show points on the same coordinate as e.g. a bigger symbol in QGIS? I found out that there ...