Within a function of pyqgis I am trying to create a layer according to multiple steps. I want to change the Geometry type option to LineString / MultiLineString in the function so that this will be done automatically. Is there a variable I can add to the function? enter image description here

shape_sym = QgsGeometryGeneratorSymbolLayer.create({'geometryModifier': 'difference(difference(make_line(start_point($geometry), centroid(offset_curve($geometry, length($geometry)/-10.0)), end_point($geometry)), buffer(start_point($geometry), 10000)), buffer(end_point( $geometry), 10000))', 'outline_color': 'black'})

1 Answer 1


Never mind, found the solution: added the line shape_sym.setSymbolType(QgsSymbol.Line) afterwords.

Your Answer

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

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