Class: QgsPolygon

class qgis.core.QgsPolygon

Bases: qgis._core.QgsCurvePolygon

Polygon geometry type.

New in version 2.10: Enums

Methods

addInteriorRing

asWkb

boundary

calculateBoundingBox

childCount

childGeometry

childPoint

clear

clearCache

clone

createEmptyWithSameType

fromWkb

geometryType

hasChildGeometries

pointDistanceToBoundary

Returns the distance from a point to the boundary of the polygon (either the exterior ring or any closer interior rings).

setExteriorRing

setZMTypeFromSubGeometry

surfaceToPolygon

toCurveType

Returns the geometry converted to the more generic curve type QgsCurvePolygon

Signals

Attributes

addInteriorRing(self, ring: QgsCurve)
asWkb(self) → QByteArray
boundary(self) → QgsAbstractGeometry
calculateBoundingBox()
childCount()
childGeometry()
childPoint()
clear(self)
clearCache()
clone(self) → QgsPolygon
createEmptyWithSameType(self) → QgsPolygon
fromWkb(self, wkb: QgsConstWkbPtr) → bool
geometryType(self) → str
hasChildGeometries()
pointDistanceToBoundary(self, x: float, y: float) → float

Returns the distance from a point to the boundary of the polygon (either the exterior ring or any closer interior rings). The returned distance will be negative if the point lies outside the polygon.

New in version 3.0.

setExteriorRing(self, ring: QgsCurve)
setZMTypeFromSubGeometry()
surfaceToPolygon(self) → QgsPolygon
toCurveType(self) → QgsCurvePolygon

Returns the geometry converted to the more generic curve type QgsCurvePolygon

Returns

the converted geometry. Caller takes ownership*