Class: QgsRasterRange

Represents a range of raster values between min and max, optionally including the min and max value.

Methods

asText

Returns a text representation of the range.

bounds

Returns the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.

contains

Returns True if this range contains the specified value.

max

Returns the maximum value for the range.

min

Returns the minimum value for the range.

overlaps

Returns True if this range overlaps another range.

setBounds

Sets the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.

setMax

Sets the maximum value for the range.

setMin

Sets the minimum value for the range.

Attributes

Exclusive

IncludeMax

IncludeMin

IncludeMinAndMax

class qgis.core.QgsRasterRange[source]

Bases: object

__init__()

Default constructor, both min and max value for the range will be set to NaN.

__init__(min: float, max: float, bounds: QgsRasterRange.BoundsType = QgsRasterRange.IncludeMinAndMax)

Constructor for a range with the given min and max values.

The bounds argument dictates how the min and max value themselves will be handled by the range.

Parameters:
  • min (float)

  • max (float)

  • bounds (QgsRasterRange.BoundsType = QgsRasterRange.IncludeMinAndMax)

__init__(a0: QgsRasterRange)
Parameters:

a0 (QgsRasterRange)

class BoundsType

Bases: int

Exclusive = 3
IncludeMax = 1
IncludeMin = 2
IncludeMinAndMax = 0
asText(self) str[source]

Returns a text representation of the range.

Added in version 3.2.

Return type:

str

bounds(self) QgsRasterRange.BoundsType[source]

Returns the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.

See also

setBounds()

Added in version 3.2.

Return type:

QgsRasterRange.BoundsType

contains(self, value: float) bool[source]

Returns True if this range contains the specified value.

Added in version 3.2.

Parameters:

value (float)

Return type:

bool

contains(value: float, rangeList: Iterable[QgsRasterRange]) bool[source]

Tests if a value is within the list of ranges

Parameters:
  • value (float) – value

  • rangeList (Iterable[QgsRasterRange]) – list of ranges

Return type:

bool

Returns:

True if value is in at least one of ranges

max(self) float[source]

Returns the maximum value for the range.

See also

setMax()

Return type:

float

min(self) float[source]

Returns the minimum value for the range.

See also

setMin()

Return type:

float

overlaps(self, other: QgsRasterRange) bool[source]

Returns True if this range overlaps another range.

Added in version 3.2.

Parameters:

other (QgsRasterRange)

Return type:

bool

setBounds(self, type: QgsRasterRange.BoundsType)[source]

Sets the bounds type for the range, which specifies whether or not the min and max values themselves are included in the range.

See also

bounds()

Added in version 3.2.

Parameters:

type (QgsRasterRange.BoundsType)

setMax(self, max: float) float[source]

Sets the maximum value for the range.

See also

max()

Parameters:

max (float)

Return type:

float

setMin(self, min: float) float[source]

Sets the minimum value for the range.

See also

min()

Parameters:

min (float)

Return type:

float