Class: QgsRasterMarkerSymbolLayer

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

Bases: qgis._core.QgsMarkerSymbolLayer

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

Raster marker symbol layer class.

New in version 3.6: Enums

Methods

bounds

calculateAspectRatio

Calculates the marker aspect ratio between width and height.

clone

copyDataDefinedProperties

copyPaintEffect

create

Creates a raster marker symbol layer from a string map of properties.

defaultAspectRatio

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

fixedAspectRatio

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

mapUnitScale

markerOffset

markerOffset2

markerOffsetWithWidthAndHeight

opacity

Returns the marker opacity.

path

Returns the marker raster image path.

preservedAspectRatio

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

properties

renderPoint

resolvePaths

Turns relative paths in properties map to absolute when reading and vice versa when writing.

restoreOldDataDefinedProperties

setFixedAspectRatio

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

setMapUnitScale

setOpacity

Set the marker opacity.

setPath

Set the marker raster image path.

setPreservedAspectRatio

Set preserved the marker aspect ratio between width and height.

updateDefaultAspectRatio

Calculates the default marker aspect ratio between width and height.

Signals

Attributes

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

clone(self) → QgsRasterMarkerSymbolLayer
copyDataDefinedProperties()
copyPaintEffect()
create(properties: Dict[str, str] = {}) → QgsSymbolLayer

Creates a raster marker symbol layer from a string map of properties.

Parameters

properties – QgsStringMap properties object

defaultAspectRatio(self) → float

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

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()
opacity(self) → float

Returns the marker opacity.

Returns

opacity value between 0 (fully transparent) and 1 (fully opaque)

See also

setOpacity()

path(self) → str

Returns the marker raster image 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()
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)
setOpacity(self, opacity: float)

Set the marker opacity.

Parameters

opacity – opacity value between 0 (fully transparent) and 1 (fully opaque)

See also

opacity()

setPath(self, path: str)

Set the marker raster image path.

Parameters

path – raster image 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

updateDefaultAspectRatio(self) → float

Calculates the default marker aspect ratio between width and height.

Returns

the default aspect ratio value