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: 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.

Parameters
  • path (str = '') –

  • size (float = DEFAULT_SVGMARKER_SIZE) –

  • angle (float = DEFAULT_SVGMARKER_ANGLE) –

  • scaleMethod

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

QRectF

calculateAspectRatio(self, context: QgsSymbolRenderContext, scaledSize: float) → Tuple[float, bool]

Calculates the marker aspect ratio between width and height.

Parameters
  • context (QgsSymbolRenderContext) – symbol render context

  • scaledSize (float) – size of symbol to render

  • hasDataDefinedAspectRatio – will be set to True if marker has data defined aspectRatio

Return type

Tuple[float, bool]

clone(self) → QgsRasterMarkerSymbolLayer
Return type

QgsRasterMarkerSymbolLayer

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

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

Parameters

properties (Dict[str) – QgsStringMap properties object

Return type

QgsSymbolLayer

defaultAspectRatio(self) → float

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

Return type

float

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

Return type

float

layerType(self) → str
Return type

str

mapUnitScale(self) → QgsMapUnitScale
Return type

QgsMapUnitScale

markerOffset()
markerOffset2()
markerOffsetWithWidthAndHeight()
opacity(self) → float

Returns the marker opacity.

Return type

float

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()

Return type

str

preservedAspectRatio(self) → bool

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

Return type

bool

properties(self) → Dict[str, str]
Return type

Dict[str, str]

renderPoint(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext)
Parameters
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.

Parameters
  • properties (Dict[str) –

  • pathResolver (QgsPathResolver) –

  • saving (bool) –

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 (float) – Fixed Aspect Ratio

setMapUnitScale(self, scale: QgsMapUnitScale)
Parameters

scale (QgsMapUnitScale) –

setOpacity(self, opacity: float)

Set the marker opacity.

Parameters

opacity (float) – 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 (str) – raster image path

See also

path()

setPreservedAspectRatio(self, par: bool) → bool

Set preserved the marker aspect ratio between width and height.

Parameters

par (bool) – Preserved Aspect Ratio

Return type

bool

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.

Return type

float

Returns

the default aspect ratio value