Class: QgsLabelPosition¶
Represents the calculated placement of a map label.
Attributes
ID of feature associated with this label.  | 
|
If non zero, indicates that the label position is part of a group of label positions (i.e. a character in a curved label).  | 
|
Heeght of label bounding box, in map units.  | 
|
  | 
|
  | 
|
  | 
|
Font which the label is rendered using.  | 
|
A polygon geometry representing the label's bounds in map coordinates.  | 
|
String shown in label.  | 
|
ID of associated map layer.  | 
|
ID of the associated label provider.  | 
|
Rotation of label, in degrees clockwise.  | 
|
  | 
|
Width of label bounding box, in map units.  | 
- class qgis.core.QgsLabelPosition[source]¶
 Bases:
object- __init__(id: int, r: float, corners: Iterable[QgsPointXY], rect: QgsRectangle, w: float, h: float, layer: str | None, labeltext: str | None, labelfont: QFont, upside_down: bool, diagram: bool = False, pinned: bool = False, providerId: str | None = '', labelGeometry: QgsGeometry = QgsGeometry(), isUnplaced: bool = False)
 Constructor for QgsLabelPosition.
- Parameters:
 id (int) – associated feature ID
r (float) – label rotation in degrees clockwise
corners (Iterable[QgsPointXY]) – corner points of label bounding box, in map units
rect (QgsRectangle) – label bounding box, in map units
w (float) – width of label, in map units
h (float) – height of label, in map units
layer (Optional[str]) – ID of associated map layer
labeltext (Optional[str]) – text rendered for label
labelfont (QFont) – font used to render label
upside_down (bool) –
Trueif label is upside downdiagram (bool = False) –
Trueif label is a diagrampinned (bool = False) –
Trueif label has pinned placementproviderId (Optional[str] = '') – ID of associated label provider
labelGeometry (
QgsGeometry= QgsGeometry()) – polygon geometry of label boundaryisUnplaced (bool = False) – set to
Trueif label was unplaced (e.g. due to collisions with other labels)
- __init__()
 
- __init__(a0: QgsLabelPosition)
 - Parameters:
 a0 (QgsLabelPosition)
- cornerPoints¶
 
- featureId¶
 ID of feature associated with this label.
- groupedLabelId¶
 If non zero, indicates that the label position is part of a group of label positions (i.e. a character in a curved label).
All other linked positions will share the same groupedLabelId.
- height¶
 Heeght of label bounding box, in map units.
- isDiagram¶
 Trueif label is a diagram.
- isPinned¶
 Trueif label position has been pinned.
- isUnplaced¶
 Trueif label position corresponds to an unplaced label.Added in version 3.10.
- labelFont¶
 Font which the label is rendered using.
- labelGeometry¶
 A polygon geometry representing the label’s bounds in map coordinates.
Added in version 3.4.9.
- labelRect¶
 
- labelText¶
 String shown in label.
- layerID¶
 ID of associated map layer.
- providerID¶
 ID of the associated label provider.
- rotation¶
 Rotation of label, in degrees clockwise.
- upsideDown¶
 Trueif label is upside down.
- width¶
 Width of label bounding box, in map units.