toloka.client.project.template_builder.conditions.DistanceConditionV1
| Source code
DistanceConditionV1( self, from_: Optional[Union[BaseComponent, str]] = None, to_: Optional[Union[BaseComponent, str]] = None, max: Optional[Union[BaseComponent, float]] = None, *, hint: Optional[Any] = None, version: Optional[str] = '1.0.0')
Checks a distance between two coordinates.
For more information, see condition.distance.
Parameters | Type | Description |
---|---|---|
from_ | Optional[Union[BaseComponent, str]] | The first point. |
to_ | Optional[Union[BaseComponent, str]] | The second point. |
max | Optional[Union[BaseComponent, float]] | The maximum distance in meters. |
hint | Optional[Any] | A hint that is shown if the condition is not met. |
Examples:
The following condition gets Toloker's location and checks that it is near the task location.
import toloka.client.project.template_builder as tbdistance_condition = tb.conditions.DistanceConditionV1( tb.data.LocationData(), tb.data.InputData('coordinates'), 500, hint='You are too far from the destination coordinates.',)
Last updated: August 28, 2023