I'm creating a layer with single sided buffers based on a line layer as virtual layer in QGIS with the following query:

    ST_SingleSidedBuffer(layer.geometry, layer.buffer_dist, layer.side) 

The buffer distance and the buffer side for each feature ist stored in the attribute table.

I would like to the set the join style to 'MITRE'. I found that there should be a way to set the option like this (https://www.gaia-gis.it/fossil/libspatialite/wiki?name=BufferOptions):

SELECT BufferOptions_SetJoinStyle('MITRE');

Unfortunately I get the following error message:

Query preparation error on PRAGMA table_info(_tview): no such function: BufferOptions_SetJoinStyle

Hence my question: Is there a way to set the buffer options globally in the QGIS project? Or is there a way to set the buffer options within the query?

  • 3
    As stated in your link, this feature set is available with SpatiaLite 5.0 and above. I believe even at version 3.20 QGIS is built with SpatiaLite 4.3.0a by default, so you do not have access to that feature set within the native QGIS environment.
    – geozelot
    Nov 9, 2021 at 9:17

1 Answer 1


As it does not seem to be possible right now using a virtual layer (as stated in the comment by @geozelot), you might want to use another method to achieve the same result. You can use QGIS expressions with Geometry generator (for visualization only) or Menu processing / Toolbox / [Geometry by expression]2 to create actual geometries (see here for details).

Use the function single_sided_buffer, it has the following syntax:


Help says:

join - join style for corners, where 1 = round, 2 = miter and 3 = bevel

The whole expression thus looks something like (change the fieldnames "buffer_dist" and buffer_side):

    "buffer_dist" * "buffer_side",

The expression, here with Geometry genrator - initial line in red, buffers in blue: enter image description here

  • This topic is about a Virtual Layer, not Geometry by expression, Geometry generator etc. :)
    – Taras
    Nov 9, 2021 at 12:21
  • Yes, I know :-) But as someone commented, it seems not to be possible with virtual layer - so this is probably the closest way to achieve the result. Sometimes a question is not so much about a particular method how to achieve someting, but simply to draw the OP to other possibilities how to achieve the same result.
    – Babel
    Nov 9, 2021 at 12:48
  • Thanks @Babel for your input! I appreciate your out of the box thinking :) The reason I'm using a virtual layer here is that I need the buffer layer to be dynamically and I also want to be able to export the geometries to a file (so I need the actual geometries). I also created a spatial model which is generating a buffer layer, but this solution is not dynamically. And as far as I know Geometry by expression is also not dynamically.
    – r.bs
    Nov 24, 2021 at 7:06
  • Geomtry generator is dynamic, but does not create actual geometries. Geomtry by expression creates actual geometries, but is not dynamic. But combining both (depending on your workflow) could solve the problem. You say you want to export the geometries to a file: this will not be dynamic, either, and is exactly what Geomerty by expression does.
    – Babel
    Nov 24, 2021 at 12:53

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.