Class: QgsPolygon¶
Polygon geometry type.
Class Hierarchy¶
Base classes¶
Curve polygon geometry type. |
|
Surface geometry type. |
|
Abstract base class for all geometries. |
Subclasses¶
Triangle geometry type. |
Abstract Methods
Returns the geometry converted to the more generic curve type |
Methods
Returns the distance from a point to the boundary of the polygon (either the exterior ring or any closer interior rings). |
- class qgis.core.QgsPolygon[source]¶
Bases:
QgsCurvePolygon
- __init__()
Constructor for an empty polygon geometry.
- __init__(exterior: QgsLineString | None, rings: Iterable[QgsLineString] = [])
Constructor for QgsPolygon, with the specified
exterior
ring and interiorrings
.Ownership of
exterior
andrings
is transferred to the polygon.Added in version 3.14.
- Parameters:
exterior (Optional[QgsLineString])
rings (Iterable[QgsLineString] = [])
- __init__(a0: QgsPolygon)
- Parameters:
a0 (QgsPolygon)
- pointDistanceToBoundary(self, x: float, y: float) float [source]¶
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.
- Parameters:
x (float)
y (float)
- Return type:
float
- abstract toCurveType(self) QgsCurvePolygon | None [source]¶
Returns the geometry converted to the more generic curve type
QgsCurvePolygon
- Return type:
Optional[QgsCurvePolygon]
- Returns:
the converted geometry. Caller takes ownership