Toloka documentation


toloka.client.project.template_builder.conditions.DistanceConditionV1 | Source code

    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'

This component checks whether the sent coordinates match the ones that you specified

For example, you want a Toloker to take a photo of a specific place. The condition.distance component checks whether the photo was taken at the location that you specified.

Parameters Description

Parameters Type Description
from_ Optional[Union[BaseComponent, str]]

First point.

to_ Optional[Union[BaseComponent, str]]

Second point.

max Optional[Union[BaseComponent, float]]

The distance in meters by which the X and Y coordinates may differ.

hint Optional[Any]

Validation error message that a Toloker will see.


How to check that a Toloker is in the right place.

distance_condition = tb.conditions.DistanceConditionV1(,'coordinates'),
    hint='You are too far from the destination coordinates.',