4

Is there any built-in tool in QGIS that I can use to buffer points to a variable size (I want to circles around the points, with widths dependent on an attribute in the point layer)?

The Vector/Geoprocessing/Buffer tool only lets me set a fixed buffer size for all features.

2
  • 3
    Hit the small rectangle with the triangles to the right of the buffer field, there you may choose which attribute to use for buffering.
    – Erik
    Jul 6, 2020 at 12:39
  • @Erik Oh, I somehow missed that, thanks!
    – leo
    Jul 6, 2020 at 14:18

3 Answers 3

8

There is another solution to this: you can use geometry generator to style your pointlayer. As geometrytype, choose polygon and than define an expression like this one:

buffer($geometry, "your_field" )

The advantage: you can play around with the parameters of the expression and observe changes in realtime (like increasing the buffer size by a multiplication factor to get ideal size).

If you want to make your buffer permanent as a separate layer, you can use the "geometry by expression" algorithm from the processing toolbox: https://docs.qgis.org/3.10/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#geometry-by-expression

See the screenshot, where I used the fid to scale the buffer - this does not really make sense, it's just for demonstration purpose. Instead of fid insert the name of the attribute field you want to use (in the expression editor under fields and values in the column in the middle). I added a multiply-factor of 500 - otherwise the buffer would have been to small to be seen.

enter image description here

1
  • Good idea, I usually use buffers following strict rules, therefore I directly save the output and didn't think about this.
    – Erik
    Jul 6, 2020 at 14:23
7

In the built-in Buffer tool, the field selection has been replaced by the familiar Data defined override icon. Simply click this and select the relevant field, or create an expression using the field.

data override

results

That said, @babel's solution is excellent in that it does not create a separate layer for the buffers. If you plan to add to or edit the points layer, you won't need to re-run the buffer each time.

If you prefer a standalone polygon output layer, the built-in tool will suffice.

7

Alternatively, method #3:

For QGIS, using the new virtual layer with the SQL script in the form window -

SELECT id, ST_Buffer(geometry, variable*0.001) geom_varbyffer, variable
FROM <table_name>
ORDER BY id;

where a variable is a field with the name "variable", in which the values of buffer zones' sizes are located

  1. be sure to replace with your field name;
  2. be sure to set the necessary size of the constant buffer;
  3. be sure to re-save the obtained result.
1
  • 1
    @Taras, and where is the place for humor - choose any proposed solution or choose all at once :-).... Jul 6, 2020 at 18:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.