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_
2
  • 2
    Creating buffer will need geometry in all case (virtual layer or geometry generator) Could you expend on what is your problem exactly ? Commented Jan 30, 2023 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: gis.stackexchange.com/a/392619/88814 To create several buffers at once on the same layer with the same expression see: gis.stackexchange.com/a/424363/88814 Commented Jan 30, 2023 at 13:16

1 Answer 1

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;
1
  • Thank's a lot! :) Commented Jan 30, 2023 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.