My script uses a buffer and dissolves to create polygons around my points. However, there are holes in between the points. I do not want to increase the distance because then it will also cover the unnecessary areas. Is there an option that covers the holes in my polygon? my script is below:

enter image description here

from qgis import processing
from datetime import datetime, timedelta

inlayDir = iface.activeLayer()

buffer_dist = 0.8

polygon =  processing.runAndLoadResults("native:buffer",

2 Answers 2


Delete holes:

Takes a polygon layer and removes holes in polygons

Use buffer output as input:

layer = iface.activeLayer()

buffered = processing.run("native:buffer", 

enter image description here


Since QGIS 3.0 there is another option available by utilization of the removeInteriorRings() method of the QgsGeometry class.

Removes the interior rings from a (multi)polygon geometry.

If the minimumAllowedArea parameter is specified then only rings smaller than this minimum area will be removed.

from qgis import processing
from qgis.utils import iface
from qgis.core import edit, QgsGeometry, QgsProject

inlayDir = iface.activeLayer()

buffer_dist = 0.8

polygon = processing.run("native:buffer", {
            'INPUT': inlayDir,
            'DISTANCE': buffer_dist,
            'SEGMENTS': 2,
            'END_CAP_STYLE': 0,
            'JOIN_STYLE': 0,
            'MITER_LIMIT': 2,
            'DISSOLVE': True,

with edit(polygon):
    for feat in polygon.getFeatures():
        wkt_geom = feat.geometry().removeInteriorRings(minimumAllowedArea=-1).asWkt()
        geom = QgsGeometry.fromWkt(wkt_geom)
        polygon.changeGeometry(feat.id(), geom)


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.