Class: QgsRasterFillSymbolLayer

A fill symbol layer which fills polygons with a repeated raster image.

Class Hierarchy

Inheritance diagram of qgis.core.QgsRasterFillSymbolLayer

Base classes

QgsImageFillSymbolLayer

Base class for fill symbol layers which fill polygons with a repeated image.

QgsFillSymbolLayer

Abstract base class for fill symbol layers.

QgsSymbolLayer

Abstract base class for symbol layers.

Enums

FillCoordinateMode

alias of SymbolCoordinateReference

Methods

coordinateMode

Coordinate mode for fill.

height

Returns the height used for scaling the image used in the fill.

imageFilePath

The path to the raster image used for the fill.

offset

Returns the offset for the fill.

offsetMapUnitScale

Returns the map unit scale for the fill's offset.

offsetUnit

Returns the units for the fill's offset.

opacity

Returns the opacity for the raster image used in the fill.

setCoordinateMode

Set the coordinate mode for fill.

setHeight

Sets the height for scaling the image.

setImageFilePath

Sets the path to the raster image used for the fill.

setOffset

Sets the offset for the fill.

setOffsetMapUnitScale

Sets the map unit scale for the fill's offset.

setOffsetUnit

Sets the units for the fill's offset.

setOpacity

Sets the opacity for the raster image used in the fill.

setSizeMapUnitScale

Sets the map unit scale for the image's width and height.

setSizeUnit

Sets the unit for the image's width and height.

setWidth

Sets the width for scaling the image used in the fill.

setWidthMapUnitScale

Sets the map unit scale for the image's width.

setWidthUnit

Sets the unit for the image's width.

sizeMapUnitScale

Returns the map unit scale for the image's width and height.

sizeUnit

Returns the units for the image's width and height.

width

Returns the width used for scaling the image used in the fill.

widthMapUnitScale

Returns the map unit scale for the image's width.

widthUnit

Returns the units for the image's width.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsRasterFillSymbolLayer. See the FAQ for more details.

applyBrushTransformFromContext

applyDataDefinedSettings

Static Methods

create

Creates a new QgsRasterFillSymbolLayer from a properties map.

createFromSld

Creates a new QgsRasterFillSymbolLayer from a SLD element.

resolvePaths

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

class qgis.core.QgsRasterFillSymbolLayer[source]

Bases: QgsImageFillSymbolLayer

__init__(imageFilePath: str | None = '')

Constructor for QgsRasterFillSymbolLayer, using a raster fill from the specified imageFilePath.

Parameters:

imageFilePath (Optional[str] = '')

FillCoordinateMode

alias of SymbolCoordinateReference

virtual applyBrushTransformFromContext(self, context: QgsSymbolRenderContext | None = None) bool[source]
Parameters:

context (Optional[QgsSymbolRenderContext] = None)

Return type:

bool

virtual applyDataDefinedSettings(self, context: QgsSymbolRenderContext)[source]
Parameters:

context (QgsSymbolRenderContext)

coordinateMode(self) Qgis.SymbolCoordinateReference[source]

Coordinate mode for fill. Controls how the top left corner of the image fill is positioned relative to the feature.

Return type:

Qgis.SymbolCoordinateReference

Returns:

coordinate mode

static create(properties: Dict[str, Any] = {}) QgsSymbolLayer | None[source]

Creates a new QgsRasterFillSymbolLayer from a properties map. The caller takes ownership of the returned object.

Parameters:

properties (Dict[str, Any] = {})

Return type:

Optional[QgsSymbolLayer]

static createFromSld(element: QDomElement) QgsSymbolLayer | None[source]

Creates a new QgsRasterFillSymbolLayer from a SLD element. The caller takes ownership of the returned object.

Added in version 3.30.

Parameters:

element (QDomElement)

Return type:

Optional[QgsSymbolLayer]

height(self) float[source]

Returns the height used for scaling the image used in the fill.

If the height is 0 then the height will be calculated automatically based on the image’s width().

See also

width()

See also

setHeight()

Added in version 3.36.

Return type:

float

imageFilePath(self) str[source]

The path to the raster image used for the fill.

Return type:

str

Returns:

path to image file

offset(self) QPointF[source]

Returns the offset for the fill.

Return type:

QPointF

Returns:

offset for fill

See also

setOffset()

See also

offsetUnit()

offsetMapUnitScale(self) QgsMapUnitScale

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

Return type:

QgsMapUnitScale

Returns:

map unit scale for offset

See also

offset()

See also

offsetUnit()

offsetUnit(self) Qgis.RenderUnit[source]

Returns the units for the fill’s offset.

Return type:

Qgis.RenderUnit

Returns:

units for offset

See also

setOffsetUnit()

See also

offset()

opacity(self) float[source]

Returns the opacity for the raster image used in the fill.

Return type:

float

Returns:

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

See also

setOpacity()

static resolvePaths(properties: Dict[str, Any], pathResolver: QgsPathResolver, saving: bool)[source]

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

Parameters:
setCoordinateMode(self, mode: Qgis.SymbolCoordinateReference)[source]

Set the coordinate mode for fill. Controls how the top left corner of the image fill is positioned relative to the feature.

Parameters:

mode (Qgis.SymbolCoordinateReference) – coordinate mode

See also

coordinateMode()

setHeight(self, height: float)[source]

Sets the height for scaling the image.

If height is 0 then the height will be calculated automatically based on the image’s width().

See also

setWidth()

See also

height()

See also

width()

Added in version 3.36.

Parameters:

height (float)

setImageFilePath(self, imagePath: str | None)[source]

Sets the path to the raster image used for the fill.

Parameters:

imagePath (Optional[str]) – path to image file

See also

imageFilePath()

setOffset(self, offset: QPointF | QPoint)[source]

Sets the offset for the fill.

Parameters:

offset (Union[QPointF, QPoint]) – offset for fill

See also

offset()

See also

setOffsetUnit()

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)[source]

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

Parameters:

scale (QgsMapUnitScale) – map unit scale for offset

See also

setOffset()

See also

setOffsetUnit()

setOffsetUnit(self, unit: Qgis.RenderUnit)[source]

Sets the units for the fill’s offset.

Parameters:

unit (Qgis.RenderUnit) – units for offset

See also

offsetUnit()

See also

setOffset()

setOpacity(self, opacity: float)[source]

Sets the opacity for the raster image used in the fill.

Parameters:

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

See also

opacity()

setSizeMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale for the image’s width and height.

See also

setWidth()

See also

setHeight()

See also

setSizeUnit()

Added in version 3.36.

Parameters:

scale (QgsMapUnitScale)

setSizeUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the image’s width and height.

See also

widthUnit()

See also

setWidth()

Added in version 3.36.

Parameters:

unit (Qgis.RenderUnit)

setWidth(self, width: float)[source]

Sets the width for scaling the image used in the fill.

If width is 0 then the width will be calculated automatically based on the image’s height().

See also

width()

See also

height()

See also

setHeight()

See also

setSizeUnit()

Parameters:

width (float)

setWidthMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale for the image’s width.

See also

setWidth()

See also

setWidthUnit()

Deprecated since version 3.40: Use setSizeMapUnitScale() instead.

Parameters:

scale (QgsMapUnitScale)

setWidthUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the image’s width.

See also

widthUnit()

See also

setWidth()

Deprecated since version 3.40: Use setSizeUnit() instead.

Parameters:

unit (Qgis.RenderUnit)

sizeMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the image’s width and height.

See also

width()

See also

height()

See also

sizeUnit()

Added in version 3.36.

Return type:

QgsMapUnitScale

sizeUnit(self) Qgis.RenderUnit[source]

Returns the units for the image’s width and height.

See also

setSizeUnit()

See also

width()

See also

height()

Added in version 3.36.

Return type:

Qgis.RenderUnit

width(self) float[source]

Returns the width used for scaling the image used in the fill.

If the width is 0 then the width will be calculated automatically based on the image’s height().

See also

height()

See also

setWidth()

See also

sizeUnit()

Return type:

float

widthMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the image’s width.

See also

width()

See also

widthUnit()

Deprecated since version 3.40: Use sizeMapUnitScale() instead.

Return type:

QgsMapUnitScale

widthUnit(self) Qgis.RenderUnit[source]

Returns the units for the image’s width.

See also

setWidthUnit()

See also

width()

Deprecated since version 3.40: Use sizeUnit() instead.

Return type:

Qgis.RenderUnit