I have have a line feature which is split in equal pieces (v.split) of 20m. Now I try to Buffer each line segment only on the sides with 5m to get equal sized polygons in QGIS 3.1, like shown in the picture below.
Running the buffer function in QGIS with:
{ 'DISSOLVE' : False,
'DISTANCE' : 5,
'END_CAP_STYLE' : 2,
'INPUT' : '[...mypath...]',
'JOIN_STYLE' : 1,
'MITER_LIMIT' : 3,
'OUTPUT' : 'TEMPORARY_OUTPUT',
'SEGMENTS' : 5 }
creates similar looking result but buffers also the line end which mix up the length defined by the line segment and leads to overlapping polygons (see I)
Using this input:
{ 'DISSOLVE' : False,
'DISTANCE' : 5,
'END_CAP_STYLE' : 1,
'INPUT' : '[...mypath...]',
'JOIN_STYLE' : 1,
'MITER_LIMIT' : 2,
'OUTPUT' : 'TEMPORARY_OUTPUT',
'SEGMENTS' : 5 }
also leads to overlap and this edgy transition zones in the corner. (see II)
How can I create a result looks like described in the first picture?
Update:
I tried to implement xunilk's answer, but I'm stucking at some point. I have a line feature separated in 20m pieces (except the last is 18m), with an individual id.
but I'm getting this error message:
File "<input>", line 1, in <module>
File "<string>", line 113, in <module>
TypeError: LineString geometry cannot be converted to a point.
Only Point types are permitted.