Subgroup: Marker

Class: QgsMarkerSymbolLayer

class qgis.core.QgsMarkerSymbolLayer

Bases: qgis._core.QgsSymbolLayer

Abstract base class for marker symbol layers.

Methods

angle Returns the rotation angle for the marker, in degrees clockwise from north.
bounds Returns the approximate bounding box of the marker symbol layer, taking into account any data defined overrides and offsets which are set for the marker layer.
clone Shall be reimplemented by subclasses to create a deep copy of the instance.
color The fill color.
copyDataDefinedProperties
copyPaintEffect
dataDefinedProperties Returns a reference to the symbol layer’s property collection, used for data defined overrides.
drawPreviewIcon
dxfAngle get angle
dxfBrushColor get brush/fill color
dxfBrushStyle get brush/fill style
dxfColor get color
dxfCustomDashPattern get dash pattern
dxfOffset get offset
dxfPenStyle get pen style
dxfWidth get line width
enabled Returns true if symbol layer is enabled and will be drawn.
estimateMaxBleed Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context.
fillColor Get fill color.
horizontalAnchorPoint Returns the horizontal anchor point for positioning the symbol.
isCompatibleWithSymbol Returns if the layer can be used below the specified symbol
isLocked
layerType Returns a string that represents this layer type.
mapUnitScale
markerOffset Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.
markerOffset2
markerOffsetWithWidthAndHeight Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.
offset Returns the marker’s offset, which is the horizontal and vertical displacement which the rendered marker will have from the original feature’s geometry.
offsetMapUnitScale Returns the map unit scale for the symbol’s offset.
offsetUnit Returns the units for the symbol’s offset.
ogrFeatureStyle
outputUnit
paintEffect Returns the current paint effect for the layer.
prepareExpressions Prepares all data defined property expressions for evaluation.
properties Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer.
propertyDefinitions Returns the symbol layer property definitions.
renderPoint Renders a marker at the specified point.
renderingPass
restoreOldDataDefinedProperties
scaleMethod Returns the method to use for scaling the marker’s size.
setAngle Sets the rotation angle for the marker.
setColor The fill color.
setDataDefinedProperties Sets the symbol layer’s property collection, used for data defined overrides.
setDataDefinedProperty Sets a data defined property for the layer.
setEnabled Sets whether symbol layer is enabled and should be drawn.
setFillColor Set fill color.
setHorizontalAnchorPoint Sets the horizontal anchor point for positioning the symbol.
setLineAngle Sets the line angle modification for the symbol’s angle.
setLocked
setMapUnitScale
setOffset Sets the marker’s offset, which is the horizontal and vertical displacement which the rendered marker should have from the original feature’s geometry.
setOffsetMapUnitScale Sets the map unit scale for the symbol’s offset.
setOffsetUnit Sets the units for the symbol’s offset.
setOutputUnit
setPaintEffect Sets the current paint effect for the layer.
setRenderingPass
setScaleMethod Sets the method to use for scaling the marker’s size.
setSize Sets the symbol size.
setSizeMapUnitScale Sets the map unit scale for the symbol’s size.
setSizeUnit Sets the units for the symbol’s size.
setStrokeColor Set stroke color.
setSubSymbol set layer’s subsymbol. takes ownership of the passed symbol
setVerticalAnchorPoint Sets the vertical anchor point for positioning the symbol.
size Returns the symbol size.
sizeMapUnitScale Returns the map unit scale for the symbol’s size.
sizeUnit Returns the units for the symbol’s size.
startRender
stopRender
strokeColor Get stroke color.
subSymbol Returns the symbol’s sub symbol, if present.
toSld
type
usedAttributes Returns the set of attributes referenced by the layer.
verticalAnchorPoint Returns the vertical anchor point for positioning the symbol.
writeDxf write as DXF
writeSldMarker Writes the symbol layer definition as a SLD XML element.

Attributes

Bottom
HCenter
Left
PropertyAngle
PropertyArrowHeadLength
PropertyArrowHeadThickness
PropertyArrowHeadType
PropertyArrowStartWidth
PropertyArrowType
PropertyArrowWidth
PropertyBlurRadius
PropertyCapStyle
PropertyCharacter
PropertyCoordinateMode
PropertyCustomDash
PropertyDisplacementX
PropertyDisplacementY
PropertyDistanceX
PropertyDistanceY
PropertyFile
PropertyFillColor
PropertyFillStyle
PropertyGradientReference1IsCentroid
PropertyGradientReference1X
PropertyGradientReference1Y
PropertyGradientReference2IsCentroid
PropertyGradientReference2X
PropertyGradientReference2Y
PropertyGradientSpread
PropertyGradientType
PropertyHeight
PropertyHorizontalAnchor
PropertyInterval
PropertyJoinStyle
PropertyLayerEnabled
PropertyLineAngle
PropertyLineDistance
PropertyName
PropertyOffset
PropertyOffsetAlongLine
PropertyOpacity
PropertyPlacement
PropertyPreserveAspectRatio
PropertySecondaryColor
PropertyShapeburstIgnoreRings
PropertyShapeburstMaxDistance
PropertyShapeburstUseWholeShape
PropertySize
PropertyStrokeColor
PropertyStrokeStyle
PropertyStrokeWidth
PropertyVerticalAnchor
PropertyWidth
Right
Top
VCenter
Bottom = 2
HCenter = 1
class HorizontalAnchorPoint

Bases: int

Left = 0
Right = 2
Top = 0
VCenter = 1
class VerticalAnchorPoint

Bases: int

angle(self) → float

Returns the rotation angle for the marker, in degrees clockwise from north.

See also

setAngle()

bounds(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext) → QRectF

Returns the approximate bounding box of the marker symbol layer, taking into account any data defined overrides and offsets which are set for the marker layer.

Returns:approximate symbol bounds, in painter units

New in version 2.14.

copyDataDefinedProperties()
copyPaintEffect()
drawPreviewIcon(self, context: QgsSymbolRenderContext, size: QSize)
horizontalAnchorPoint(self) → QgsMarkerSymbolLayer.HorizontalAnchorPoint

Returns the horizontal anchor point for positioning the symbol. The symbol will be drawn so that the horizontal anchor point is aligned with the marker’s desired location.

mapUnitScale(self) → QgsMapUnitScale
markerOffset(self, context: QgsSymbolRenderContext) → Tuple[float, float]

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.

Parameters:
  • context – symbol render context
  • offsetX – will be set to required horizontal offset (in painter units)
  • offsetY – will be set to required vertical offset (in painter units)
markerOffset2(self, context: QgsSymbolRenderContext, width: float, height: float, widthUnit: QgsUnitTypes.RenderUnit, heightUnit: QgsUnitTypes.RenderUnit, widthMapUnitScale: QgsMapUnitScale, heightMapUnitScale: QgsMapUnitScale) → Tuple[float, float]

Note

available in Python bindings as markerOffset2

markerOffsetWithWidthAndHeight(self, context: QgsSymbolRenderContext, width: float, height: float) → Tuple[float, float]

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.

Parameters:
  • context – symbol render context
  • width – marker width
  • height – marker height
  • offsetX – will be set to required horizontal offset (in painter units)
  • offsetY – will be set to required vertical offset (in painter units)

Note

available in Python as markerOffsetWithWidthAndHeight

offset(self) → QPointF

Returns the marker’s offset, which is the horizontal and vertical displacement which the rendered marker will have from the original feature’s geometry. Units are specified by offsetUnit().

See also

setOffset()

See also

offsetUnit()

offsetMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale for the symbol’s offset.

See also

offset()

See also

offsetUnit()

offsetUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the symbol’s offset.

See also

setOffsetUnit()

See also

offset()

outputUnit(self) → QgsUnitTypes.RenderUnit
renderPoint(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext)

Renders a marker at the specified point. Derived classes must implement this to handle drawing the point.

Parameters:
  • point – position at which to render point, in painter units
  • context – symbol render context
restoreOldDataDefinedProperties()
scaleMethod(self) → QgsSymbol.ScaleMethod

Returns the method to use for scaling the marker’s size.

See also

setScaleMethod()

setAngle(self, angle: float)

Sets the rotation angle for the marker.

Parameters:angle – angle in degrees clockwise from north.

See also

angle()

See also

setLineAngle()

setHorizontalAnchorPoint(self, h: QgsMarkerSymbolLayer.HorizontalAnchorPoint)

Sets the horizontal anchor point for positioning the symbol.

Parameters:h – anchor point. Symbol will be drawn so that the horizontal anchor point is aligned with

the marker’s desired location.

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 clockwise from north, valid values are between 0 and 360

New in version 2.9.

See also

setAngle()

See also

angle()

setMapUnitScale(self, scale: QgsMapUnitScale)
setOffset(self, offset: Union[QPointF, QPoint])

Sets the marker’s offset, which is the horizontal and vertical displacement which the rendered marker should have from the original feature’s geometry.

Parameters:offset – marker offset. Units are specified by offsetUnit()

See also

offset()

See also

setOffsetUnit()

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the symbol’s offset.

Parameters:scale – offset map unit scale

See also

setOffset()

See also

setOffsetUnit()

setOffsetUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the symbol’s offset.

Parameters:unit – offset units

See also

offsetUnit()

See also

setOffset()

setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)
setScaleMethod(self, scaleMethod: QgsSymbol.ScaleMethod)

Sets the method to use for scaling the marker’s size.

Parameters:scaleMethod – scale method

See also

scaleMethod()

setSize(self, size: float)

Sets the symbol size.

Parameters:size – symbol size. Units are specified by sizeUnit().

See also

size()

See also

setSizeUnit()

setSizeMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the symbol’s size.

Parameters:scale – size map unit scale

See also

setSize()

See also

setSizeUnit()

setSizeUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the symbol’s size.

Parameters:unit – size units

See also

sizeUnit()

See also

setSize()

setVerticalAnchorPoint(self, v: QgsMarkerSymbolLayer.VerticalAnchorPoint)

Sets the vertical anchor point for positioning the symbol.

Parameters:v – anchor point. Symbol will be drawn so that the vertical anchor point is aligned with

the marker’s desired location.

size(self) → float

Returns the symbol size. Units are specified by sizeUnit().

See also

setSize()

See also

sizeUnit()

See also

sizeUnitMapScale()

sizeMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale for the symbol’s size.

See also

size()

See also

sizeUnit()

sizeUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the symbol’s size.

See also

setSizeUnit()

See also

size()

startRender(self, context: QgsSymbolRenderContext)
toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])
verticalAnchorPoint(self) → QgsMarkerSymbolLayer.VerticalAnchorPoint

Returns the vertical anchor point for positioning the symbol. The symbol will be drawn so that the vertical anchor point is aligned with the marker’s desired location.

writeSldMarker(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])

Writes the symbol layer definition as a SLD XML element.

Parameters:
  • doc – XML document
  • element – parent XML element
  • props – symbol layer definition (see properties())