Subgroup: Svg

Class: QgsSvgMarkerSymbolLayer

class qgis.core.QgsSvgMarkerSymbolLayer(path: str, size: float = DEFAULT_SVGMARKER_SIZE, angle: float = DEFAULT_SVGMARKER_ANGLE, scaleMethod: QgsSymbol.ScaleMethod = DEFAULT_SCALE_METHOD)

Bases: qgis._core.QgsMarkerSymbolLayer

Constructs SVG marker symbol layer with picture from given absolute path to a SVG file

QgsSvgMarkerSymbolLayer(QgsSvgMarkerSymbolLayer)

Methods

angle Returns the rotation angle for the marker, in degrees clockwise from north.
bounds
calculateAspectRatio Calculates the marker aspect ratio between width and height.
clone
color The fill color.
copyDataDefinedProperties
copyPaintEffect
create
createFromSld
dataDefinedProperties Returns a reference to the symbol layer’s property collection, used for data defined overrides.
defaultAspectRatio Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
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
fixedAspectRatio Returns the marker aspect ratio between width and height to be used in rendering,
horizontalAnchorPoint Returns the horizontal anchor point for positioning the symbol.
isCompatibleWithSymbol Returns if the layer can be used below the specified symbol
isLocked
layerType
mapUnitScale
markerOffset
markerOffset2
markerOffsetWithWidthAndHeight
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.
path Returns the marker SVG path.
prepareExpressions Prepares all data defined property expressions for evaluation.
preservedAspectRatio Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
properties
propertyDefinitions Returns the symbol layer property definitions.
renderPoint
renderingPass
resolvePaths Turns relative paths in properties map to absolute when reading and vice versa when writing.
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
setFixedAspectRatio Set the marker aspect ratio between width and height to be used in rendering,
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.
setPath Set the marker SVG path.
setPreservedAspectRatio Set preserved the marker aspect ratio between width and height.
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
setStrokeWidth
setStrokeWidthMapUnitScale
setStrokeWidthUnit Sets the units for the stroke width.
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
strokeWidth
strokeWidthMapUnitScale
strokeWidthUnit Returns the units for the stroke width.
subSymbol Returns the symbol’s sub symbol, if present.
toSld
type
updateDefaultAspectRatio Calculates the default marker aspect ratio between width and height.
usedAttributes Returns the set of attributes referenced by the layer.
verticalAnchorPoint Returns the vertical anchor point for positioning the symbol.
writeDxf
writeSldMarker

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
bounds(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext) → QRectF
calculateAspectRatio(self, context: QgsSymbolRenderContext, scaledSize: float) → Tuple[float, bool]

Calculates the marker aspect ratio between width and height.

Parameters:
  • context – symbol render context
  • scaledSize – size of symbol to render
  • hasDataDefinedAspectRatio – will be set to true if marker has data defined aspectRatio

Note

not available in Python bindings

clone(self) → QgsSvgMarkerSymbolLayer
copyDataDefinedProperties()
copyPaintEffect()
create(properties: Dict[str, str] = {}) → QgsSymbolLayer
createFromSld(element: QDomElement) → QgsSymbolLayer
defaultAspectRatio(self) → float

Returns the default marker aspect ratio between width and height, 0 if not yet calculated.

fillColor(self) → QColor
fixedAspectRatio(self) → float

Returns the marker aspect ratio between width and height to be used in rendering, if the value set is lower or equal to 0 the aspect ratio will be preserved in rendering

layerType(self) → str
mapUnitScale(self) → QgsMapUnitScale
markerOffset()
markerOffset2()
markerOffsetWithWidthAndHeight()
outputUnit(self) → QgsUnitTypes.RenderUnit
path(self) → str

Returns the marker SVG path.

See also

setPath()

preservedAspectRatio(self) → bool

Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.

properties(self) → Dict[str, str]
renderPoint(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext)
resolvePaths(properties: Dict[str, str], pathResolver: QgsPathResolver, saving: bool)

Turns relative paths in properties map to absolute when reading and vice versa when writing. Used internally when reading/writing symbols.

New in version 3.0.

restoreOldDataDefinedProperties()
setFillColor(self, color: Union[QColor, Qt.GlobalColor])
setFixedAspectRatio(self, ratio: float)

Set the marker aspect ratio between width and height to be used in rendering, if the value set is lower or equal to 0 the aspect ratio will be preserved in rendering

Parameters:ratio – Fixed Aspect Ratio
setMapUnitScale(self, scale: QgsMapUnitScale)
setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)
setPath(self, path: str)

Set the marker SVG path.

Parameters:path – SVG path

See also

path()

setPreservedAspectRatio(self, par: bool) → bool

Set preserved the marker aspect ratio between width and height.

Parameters:par – Preserved Aspect Ratio
Returns:the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0
setStrokeColor(self, c: Union[QColor, Qt.GlobalColor])
setStrokeWidth(self, w: float)
setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)
setStrokeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the stroke width.

Parameters:unit – width units
startRender(self, context: QgsSymbolRenderContext)
stopRender(self, context: QgsSymbolRenderContext)
strokeColor(self) → QColor
strokeWidth(self) → float
strokeWidthMapUnitScale(self) → QgsMapUnitScale
strokeWidthUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the stroke width.

updateDefaultAspectRatio(self) → float

Calculates the default marker aspect ratio between width and height.

Returns:the default aspect ratio value
writeDxf(self, e: QgsDxfExport, mmMapUnitScaleFactor: float, layerName: str, context: QgsSymbolRenderContext, shift: Union[QPointF, QPoint] = QPointF(0, 0)) → bool
writeSldMarker(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str])