PyQGIS – Method for Generating Wedge Buffer in PyQGIS

bufferpyqgisqgis

Is there any method generating a wedge buffer, as in Creating wedge buffers from many to one in QGIS, using QGIS Python API?

I made a search in QGIS API Documentation and GIS SE.

I'm not looking for a script, only a useful function to generate a wedge buffer for a point.

Best Answer

Yes. Import these:

>>> from qgis.core import QgsGeometry, QgsPoint

Then:

>>> QgsGeometry.createWedgeBuffer(QgsPoint(1,2), 25, 5, 2, )
<QgsGeometry: CurvePolygon (CompoundCurve (CircularString (1.76536686473017967 3.84775906502257348, 1.84523652348139877 3.8126155740733001, 1.92349722647006782 3.77402166635644321),(1.92349722647006782 3.77402166635644321, 1 2),(1 2, 1.76536686473017967 3.84775906502257348)))>

Documented:

https://qgis.org/api/classQgsGeometry.html#ac99eef4d4d213c72559f4bd3fe5aefa6

Related Question