Class: QgsServerParameterDefinition

class qgis.server.QgsServerParameterDefinition

Bases: sip.wrapper

Definition of a parameter with basic conversion methods

Added in version 3.4.

QgsServerParameterDefinition(type: QMetaType.Type = QMetaType.Type.QString, defaultValue: Any = None) Constructor for QgsServerParameterDefinition.

Parameters:
  • type – The type of the parameter

  • defaultValue – The default value of the parameter

QgsServerParameterDefinition(type: QVariant.Type, defaultValue: Any = None) Constructor for QgsServerParameterDefinition.

Parameters:
  • type – The type of the parameter

  • defaultValue – The default value of the parameter

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

QgsServerParameterDefinition(a0: QgsServerParameterDefinition)

Methods

isValid

Returns True if the parameter is valid, False otherwise.

loadUrl

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

raiseError

Raises an exception in case of an invalid parameters.

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.

Attributes

isValid(self) bool

Returns True if the parameter is valid, False otherwise.

Return type:

bool

loadUrl(self)

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
raiseError(msg: str | None)

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

Converts the parameter into a boolean.

Return type:

bool

Returns:

A boolean

toColor(self)

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 = ',')

Converts the parameter into a list of colors.

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

  • delimiter (str = ',') -> (List[QColor]) – The character used for delimiting

Returns:

A list of colors

toDouble(self)

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 = ',')

Converts the parameter into a list of doubles.

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

  • delimiter (str = ',') -> (List[float]) – The character used for delimiting

Returns:

A list of doubles

toExpressionList(self) List[str]

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 = ',')

Converts the parameter into a list of geometries.

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

  • delimiter (str = ',') -> (List[QgsGeometry]) – The character used for delimiting

Returns:

A list of geometries

toInt(self)

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 = ',')

Converts the parameter into a list of integers.

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

  • delimiter (str = ',') -> (List[int]) – The character used for delimiting

Returns:

A list of integers

toOgcFilterList(self) List[str]

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)

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

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]

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)

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

Returns the type of the parameter as a string.

Return type:

str