Subgroup: other

Class: QgsPolygon

class qgis.core.QgsPolygon

Bases: qgis._core.QgsCurvePolygon

Polygon geometry type.

New in version 2.10: Methods

addInteriorRing
addMValue
addZValue
adjacentVertices
area
asGml2
asGml3
asJson
asWkb
asWkt
boundary
boundingBox Returns the minimal bounding box for the geometry
calculateBoundingBox
centroid Returns the centroid of the geometry
childCount
childGeometry
childPoint
clear
clearCache
clone
closestSegment
convertTo Converts the geometry to a specified type.
coordinateSequence
createEmptyWithSameType
deleteVertex
dimension
draw
dropMValue
dropZValue
exteriorRing
fromWkb
fromWkt
geometryType
hasChildGeometries
hasCurvedSegments
insertVertex
interiorRing
is3D Returns true if the geometry is 3D and contains a z-value.
isEmpty
isMeasure Returns true if the geometry contains m values.
length Returns the length of the geometry.
moveVertex
nCoordinates
nextVertex
numInteriorRings
partCount
perimeter
pointDistanceToBoundary Returns the distance from a point to the boundary of the polygon (either the exterior ring or any closer interior rings).
removeDuplicateNodes
removeInteriorRing Removes an interior ring from the polygon.
removeInteriorRings Removes the interior rings from the polygon.
ringCount
segmentLength
segmentize Returns a geometry without curves.
setExteriorRing
setInteriorRings Sets all interior rings (takes ownership)
setZMTypeFromSubGeometry
snappedToGrid
surfaceToPolygon
toCurveType Returns the geometry converted to the more generic curve type QgsCurvePolygon
toPolygon Returns a new polygon geometry corresponding to a segmentized approximation of the curve.
transform transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1)
vertexAngle Returns approximate rotation angle for a vertex.
vertexAt
vertexCount
vertexNumberFromVertexId
vertices Returns Java-style iterator for traversal of vertices of the geometry
wkbType Returns the WKB type of the geometry.
wktTypeStr Returns the WKT type string of the geometry.

Attributes

MaximumAngle
MaximumDifference
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*