1

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 generator does not meet my expectations because it needs geometry.

SELECT new_field,
       st_union(st_buffer(geometry,5)),(st_buffer(geometry,10)) as geometry 
from bufor_
Vince
  • 20,017
  • 15
  • 45
  • 64
  • 2
    Creating buffer will need geometry in all case (virtual layer or geometry generator) Could you expend on what is your problem exactly ? – J.R Jan 30 '23 at 11:16
  • Use Geometry by expression to create actual geometries from the same QGIS expressions used in Geometry generator (where you indeed create styles only, not geometries). See here for details: https://gis.stackexchange.com/a/392619/88814 To create several buffers at once on the same layer with the same expression see: https://gis.stackexchange.com/a/424363/88814 – Babel Jan 30 '23 at 13:16

1 Answers1

1

To have distinct polygons for each buffer size, create a list of distances and join it to the original table.

Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query. Adjust the layer and field names.

WITH config(dist) as (values (2000),(5000),(10000))
SELECT st_buffer(geometry,dist) as geometry, 
       dist, pt.id, pt.other_fields
FROM pt, config;
JGH
  • 41,794
  • 3
  • 43
  • 89