Subgroup: Marker

Class: QgsMarkerSymbol

class qgis.core.QgsMarkerSymbol(layers: object = QgsSymbolLayerList())

Bases: qgis._core.QgsSymbol

Methods

angle Returns the marker angle for the whole symbol.
appendSymbolLayer Append symbol layer at the end of the list Ownership will be transferred.
asImage Generate symbol as image
bigSymbolPreviewImage Returns a large (roughly 100x100 pixel) preview image for the symbol.
bounds Returns the approximate bounding box of the marker symbol, which includes the bounding box of all symbol layers for the symbol.
changeSymbolLayer delete layer at specified index and set a new one
clipFeaturesToExtent Returns whether features drawn by the symbol will be clipped to the render context’s extent.
clone
cloneLayers
color
createSimple Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
dataDefinedAngle Returns data defined angle for whole symbol (including all symbol layers).
dataDefinedSize Returns data defined size for whole symbol (including all symbol layers).
defaultSymbol return new default symbol for specified geometry type
deleteSymbolLayer delete symbol layer at specified index
drawPreviewIcon Draw icon of the symbol that occupyies area given by size using the painter.
dump
exportImage export symbol as image format. PNG and SVG supported
hasDataDefinedProperties Returns whether the symbol utilizes any data defined properties.
insertSymbolLayer Insert symbol layer to specified index Ownership will be transferred.
layer
mapUnitScale
opacity Returns the opacity for the symbol.
outputUnit Returns the units to use for sizes and widths within the symbol.
renderFeature Render a feature.
renderHints Returns the rendering hint flags for the symbol.
renderPoint
renderUsingLayer
renderVertexMarker
scaleMethod
setAngle Sets the angle for the whole symbol.
setClipFeaturesToExtent Sets whether features drawn by the symbol should be clipped to the render context’s extent.
setColor
setDataDefinedAngle Set data defined angle for whole symbol (including all symbol layers).
setDataDefinedSize Set data defined size for whole symbol (including all symbol layers).
setLayer
setLineAngle Sets the line angle modification for the symbol’s angle.
setMapUnitScale
setOpacity Sets the opacity for the symbol.
setOutputUnit Sets the units to use for sizes and widths within the symbol.
setRenderHints Sets rendering hint flags for the symbol.
setScaleMethod
setSize Sets the size for the whole symbol.
setSizeMapUnitScale Sets the size map unit scale for the whole symbol (including all symbol layers).
setSizeUnit Sets the size units for the whole symbol (including all symbol layers).
size Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the symbol.
sizeMapUnitScale Returns the size map unit scale for the whole symbol.
sizeUnit Returns the size units for the whole symbol (including all symbol layers).
startRender Begins the rendering process for the symbol.
stopRender Ends the rendering process.
symbolLayer Returns a specific symbol layers contained in the symbol.
symbolLayerCount Returns total number of symbol layers contained in the symbol.
symbolLayers Returns list of symbol layers contained in the symbol.
symbolRenderContext Returns the symbol render context.
takeSymbolLayer Remove symbol layer from the list and return pointer to it.
toSld
type
usedAttributes Return a list of attributes required to render this feature.

Attributes

DynamicRotation
Fill
Hybrid
Line
Marker
ScaleArea
ScaleDiameter
angle(self) → float

Returns the marker angle for the whole symbol. Note that for symbols with multiple symbol layers, this will correspond just to the angle of the first symbol layer.

New in version 2.16.

See also

setAngle()

bounds(self, point: Union[QPointF, QPoint], context: QgsRenderContext, feature: QgsFeature = QgsFeature()) → QRectF

Returns the approximate bounding box of the marker symbol, which includes the bounding box of all symbol layers for the symbol. It is recommended to use this method only between startRender() and stopRender() calls, or data defined rotation and offset will not be correctly calculated.

Parameters:
  • point – location of rendered point in painter units
  • context – render context
  • feature – feature being rendered at point (optional). If not specified, the bounds calculation will not

include data defined parameters such as offset and rotation

Returns:approximate symbol bounds, in painter units

New in version 2.14.

clone(self) → QgsMarkerSymbol
cloneLayers()
createSimple(properties: Dict[str, str]) → QgsMarkerSymbol

Create a marker symbol with one symbol layer: SimpleMarker with specified properties. This is a convenience method for easier creation of marker symbols.

dataDefinedAngle(self) → QgsProperty

Returns data defined angle for whole symbol (including all symbol layers).

Returns:data defined angle, or invalid property if angle is not set

at the marker level.

New in version 3.0.

dataDefinedSize(self) → QgsProperty

Returns data defined size for whole symbol (including all symbol layers).

Returns:data defined size, or invalid property if size is not set

at the marker level.

New in version 3.0.

renderPoint(self, point: Union[QPointF, QPoint], f: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False)
renderUsingLayer()
renderVertexMarker()
scaleMethod(self) → QgsSymbol.ScaleMethod
setAngle(self, symbolAngle: float)

Sets the angle for the whole symbol. Individual symbol layer sizes will be rotated to maintain their current relative angle to the whole symbol angle.

Parameters:symbolAngle – new symbol angle

See also

angle()

setDataDefinedAngle(self, property: QgsProperty)

Set data defined angle for whole symbol (including all symbol layers).

New in version 3.0.

setDataDefinedSize(self, property: QgsProperty)

Set data defined size for whole symbol (including all symbol layers).

New in version 3.0.

setLineAngle(self, lineAngle: float)

Sets the line angle modification for the symbol’s angle. This angle is added to the marker’s rotation and data defined rotation before rendering the symbol, and is usually used for orienting symbols to match a line’s angle.

Parameters:lineAngle – Angle in degrees, valid values are between 0 and 360

New in version 2.9.

setScaleMethod(self, scaleMethod: QgsSymbol.ScaleMethod)
setSize(self, size: float)

Sets the size for the whole symbol. Individual symbol layer sizes will be scaled to maintain their current relative size to the whole symbol size.

Parameters:size – new symbol size

See also

size()

See also

setSizeUnit()

setSizeMapUnitScale(self, scale: QgsMapUnitScale)

Sets the size map unit scale for the whole symbol (including all symbol layers).

Parameters:scale – map unit scale

New in version 2.16.

See also

setSizeUnit()

See also

setSize()

setSizeUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the size units for the whole symbol (including all symbol layers).

Parameters:unit – size units

New in version 2.16.

See also

sizeUnit()

See also

setSize()

size(self) → float

Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the symbol.

See also

setSize()

See also

sizeUnit()

sizeMapUnitScale(self) → QgsMapUnitScale

Returns the size map unit scale for the whole symbol. Note that for symbols with multiple symbol layers, this will correspond just to the map unit scale for the first symbol layer.

New in version 2.16.

See also

sizeUnit()

See also

size()

sizeUnit(self) → QgsUnitTypes.RenderUnit

Returns the size units for the whole symbol (including all symbol layers).

Returns:size units, or mixed units if symbol layers have different units

New in version 2.16.

See also

setSizeUnit()

See also

size()