Class: QgsServerParameterDefinition

Definition of a parameter with basic conversion methods.

Added in version 3.4.

Class Hierarchy

Inheritance diagram of qgis.server.QgsServerParameterDefinition

Subclasses

QgsServerParameter

Parameter common to all services (WMS, WFS, …).

Methods

loadUrl

Loads the data associated to the parameter converted into an url.

toBool

Converts the parameter into a boolean.

toColor

Converts the parameter into a color.

toColorList

Converts the parameter into a list of colors.

toDouble

Converts the parameter into a double.

toDoubleList

Converts the parameter into a list of doubles.

toExpressionList

Converts the parameter into a list of QGIS expressions.

toGeomList

Converts the parameter into a list of geometries.

toInt

Converts the parameter into an integer.

toIntList

Converts the parameter into a list of integers.

toOgcFilterList

Converts the parameter into a list of OGC filters.

toRectangle

Converts the parameter into a rectangle.

toString

Converts the parameter into a string.

toStringList

Converts the parameter into a list of strings

toUrl

Converts the parameter into an url.

typeName

Returns the type of the parameter as a string.

Virtual Methods

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

isValid

Returns True if the parameter is valid, False otherwise.

Static Methods

raiseError

Raises an exception in case of an invalid parameters.

Attributes

mDefaultValue

mType

mValue

class qgis.server.QgsServerParameterDefinition[source]

Bases: object

__init__(type: QMetaType.Type = QMetaType.Type.QString, defaultValue: Any = None)

Constructor for QgsServerParameterDefinition.

Parameters:
  • type (QMetaType.Type = QMetaType.Type.QString) – The type of the parameter

  • defaultValue (Any = None) – The default value of the parameter

__init__(type: QVariant.Type, defaultValue: Any = None)

Constructor for QgsServerParameterDefinition.

Parameters:
  • type (QVariant.Type) – The type of the parameter

  • defaultValue (Any = None) – The default value of the parameter

Deprecated since version 3.38: Use the method with a QMetaType.Type argument instead.

__init__(a0: QgsServerParameterDefinition)
Parameters:

a0 (QgsServerParameterDefinition)

virtual isValid(self) bool[source]

Returns True if the parameter is valid, False otherwise.

Return type:

bool

loadUrl(self)[source]

Loads the data associated to the parameter converted into an url.

Parameters:

okTrue if there’s no error during the load, False otherwise

Returns:

The content loaded

Added in version 3.4.

mDefaultValue
mType
mValue
static raiseError(msg: str | None)[source]

Raises an exception in case of an invalid parameters.

Parameters:

msg (Optional[str]) – The message describing the exception

Raises:

QgsBadRequestException – Invalid parameter exception

toBool(self) bool[source]

Converts the parameter into a boolean.

Return type:

bool

Returns:

A boolean

toColor(self)[source]

Converts the parameter into a color.

Parameters:

okTrue if there’s no error during the conversion, False otherwise

Returns:

A color

toColorList(self, delimiter: str = ',', skipEmptyParts: bool = True)

Converts the parameter into a list of colors.

Parameters:
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ') – The character used for delimiting

  • skipEmptyParts (bool = True) -> (List[QColor]) – for splitting

Returns:

A list of colors

toDouble(self)[source]

Converts the parameter into a double.

Parameters:

okTrue if there’s no error during the conversion, False otherwise

Returns:

A double

toDoubleList(self, delimiter: str = ',', skipEmptyParts: bool = True)

Converts the parameter into a list of doubles.

Parameters:
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ') – The character used for delimiting

  • skipEmptyParts (bool = True) -> (List[float]) – for splitting

Returns:

A list of doubles

toExpressionList(self) List[str][source]

Converts the parameter into a list of QGIS expressions.

Return type:

List[str]

Returns:

A list of strings

Added in version 3.24.

toGeomList(self, delimiter: str = ',', skipEmptyParts: bool = True)

Converts the parameter into a list of geometries.

Parameters:
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ') – The character used for delimiting

  • skipEmptyParts (bool = True) -> (List[QgsGeometry]) – for splitting

Returns:

A list of geometries

toInt(self)[source]

Converts the parameter into an integer.

Parameters:

okTrue if there’s no error during the conversion, False otherwise

Returns:

An integer

toIntList(self, delimiter: str = ',', skipEmptyParts: bool = True)

Converts the parameter into a list of integers.

Parameters:
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ') – The character used for delimiting

  • skipEmptyParts (bool = True) -> (List[int]) – for splitting

Returns:

A list of integers

toOgcFilterList(self) List[str][source]

Converts the parameter into a list of OGC filters.

Return type:

List[str]

Returns:

A list of strings

Added in version 3.24.

toRectangle(self)[source]

Converts the parameter into a rectangle.

Parameters:

okTrue if there’s no error during the conversion, False otherwise

Returns:

A rectangle

toString(self, defaultValue: bool = False) str[source]

Converts the parameter into a string. If defaultValue is true and current value is empty, then the default value is returned.

Parameters:

defaultValue (bool = False)

Return type:

str

toStringList(self, delimiter: str = ',', skipEmptyParts: bool = True) List[str][source]

Converts the parameter into a list of strings

Parameters:
  • delimiter (str = ') – The character used for delimiting

  • skipEmptyParts (bool = True) – To use QString.SkipEmptyParts for splitting

Return type:

List[str]

Returns:

A list of strings

toUrl(self)[source]

Converts the parameter into an url.

Parameters:

okTrue if there’s no error during the conversion, False otherwise

Returns:

An url

Added in version 3.4.

typeName(self) str[source]

Returns the type of the parameter as a string.

Return type:

str