You can do this if you create the buffers either with Virtual layer or Geometry generator.
Virtual layer: does create actual geometries. Use this query:
select st_buffer (p.geometry, b.size)
from point as p, buffersize as b
where p.id = b.id
- Replace
point with the name of the layer containing the geometries that you want to buffer.
- Replace
buffersize with the name of the csv layer containing the attribute field size that defines the buffer distance.
- Both layers should have a field called
id that joins them.
For multiple buffer distances, you can create multiple buffers, combining the repeated query with union:
SELECT st_buffer (p.geometry, b.size) as geom
from point as p, buffersize as b
where p.id = b.id
union
SELECT st_buffer (p.geometry, b.size2) as geom
from point as p, buffersize as b
where p.id = b.id
union
SELECT st_buffer (p.geometry, b.size3) as geom
from point as p, buffersize as b
where p.id = b.id
Or use st_collect to combine two buffers, but it will be a multipart feature:
select st_collect (st_buffer (p.geometry, b.size), st_buffer (p.geometry, b.size2))...
- Geometry generator: does only create the buffers as style, not actual geometries - see here for details. On the layer containing the geometries you want to buffer, create a symbol layer of the type
Geometry generator and use the expression buffer ($geometry, size). Replace size with the field from your CSV.
st_collect, see updated answer – Babel Jan 04 '22 at 10:23