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

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.PythonQgsProcessingAlgorithmSubclass)str
Parameters

outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –

Return type

str

clone(self)QgsProcessingParameterDistance
Return type

QgsProcessingParameterDistance

defaultUnit(self)QgsUnitTypes.DistanceUnit

Returns the default distance unit for the parameter.

See also

setDefaultUnit()

New in version 3.4.3.

Return type

QgsUnitTypes.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: QgsUnitTypes.DistanceUnit)

Sets the default distance unit for the parameter.

See also

defaultUnit()

New in version 3.4.3.

Parameters

unit (QgsUnitTypes.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