Class: QgsProcessingParameterDistance

class qgis.core.QgsProcessingParameterDistance

Bases: QgsProcessingParameterNumber

A double numeric parameter for distance values. Linked to a source layer or CRS parameter to determine what units the distance values are in.

The number of decimals places shown in a distance parameter’s widget can be specified by setting the parameter’s metadata. For example:

param = QgsProcessingParameterDistance( 'VAL', 'Threshold')
# only show two decimal places in parameter's widgets, not 6:
param.setMetadata( {'widget_wrapper':
  { 'decimals': 2 }
})

New in version 3.2.

QgsProcessingParameterDistance(name: str, description: str = ‘’, defaultValue: Any = None, parentParameterName: str = ‘’, optional: bool = False, minValue: float = -DBL_MAX+1, maxValue: float = DBL_MAX) Constructor for QgsProcessingParameterDistance.

QgsProcessingParameterDistance(QgsProcessingParameterDistance)

Methods

asPythonString

param outputType:

clone

rtype:

QgsProcessingParameterDistance

defaultGuiValueFromSetting

Default gui value for an algorithm parameter from settings

defaultUnit

Returns the default distance unit for the parameter.

dependsOnOtherParameters

rtype:

List[str]

fromVariantMap

param map:

parentParameterName

Returns the name of the parent parameter, or an empty string if this is not set.

setDefaultUnit

Sets the default distance unit for the parameter.

setParentParameterName

Sets the name of the parent layer parameter.

toVariantMap

rtype:

Dict[str, Any]

type

rtype:

str

typeName

Returns the type name for the parameter class.

asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonOutputType.PythonQgsProcessingAlgorithmSubclass) str
Parameters:

outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonOutputType.PythonQgsProcessingAlgorithmSubclass) –

Return type:

str

clone(self) QgsProcessingParameterDistance
Return type:

QgsProcessingParameterDistance

defaultGuiValueFromSetting(self) Any

Default gui value for an algorithm parameter from settings

Returns:

default value from settings or invalid QVariant if there is no default value defined in the settings

New in version 3.34.

defaultUnit(self) Qgis.DistanceUnit

Returns the default distance unit for the parameter.

See also

setDefaultUnit()

New in version 3.4.3.

Return type:

Qgis.DistanceUnit

dependsOnOtherParameters(self) List[str]
Return type:

List[str]

fromVariantMap(self, map: Dict[str, Any]) bool
Parameters:

map (Dict[str) –

Return type:

bool

parentParameterName(self) str

Returns the name of the parent parameter, or an empty string if this is not set.

Return type:

str

setDefaultUnit(self, unit: Qgis.DistanceUnit)

Sets the default distance unit for the parameter.

See also

defaultUnit()

New in version 3.4.3.

Parameters:

unit (Qgis.DistanceUnit) –

setParentParameterName(self, parentParameterName: str)

Sets the name of the parent layer parameter. Use an empty string if this is not required.

Parameters:

parentParameterName (str) –

toVariantMap(self) Dict[str, Any]
Return type:

Dict[str, Any]

type(self) str
Return type:

str

typeName() str

Returns the type name for the parameter class.

Return type:

str