Location¶
- class telegram.Location(longitude, latitude, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObjectThis object represents a point on the map.
Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their
longitudeandlatitudeare equal.Available In
- Parameters:
longitude (
float) – Longitude as defined by the sender.latitude (
float) – Latitude as defined by the sender.horizontal_accuracy (
float, optional) – The radius of uncertainty for the location, measured in meters; 0-1500.live_period (
int|datetime.timedelta, optional) –Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only.
Changed in version v22.2:
datetime.timedeltaobjects are accepted in addition to plainintvalues.heading (
int, optional) – The direction in which user is moving, in degrees;1-360. For active live locations only.proximity_alert_radius (
int, optional) – Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
- horizontal_accuracy[source]¶
Optional. The radius of uncertainty for the location, measured in meters; 0-
1500.- Type:
float
- live_period[source]¶
Optional. Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only.
Deprecated since version v22.2: In a future major version this attribute will be of type
datetime.timedelta. You can opt-in early by setting PTB_TIMEDELTA=true orPTB_TIMEDELTA=1as an environment variable.- Type:
int|datetime.timedelta
- heading[source]¶
Optional. The direction in which user is moving, in degrees;
1-360. For active live locations only.- Type:
int
- proximity_alert_radius[source]¶
Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
- Type:
int
- HORIZONTAL_ACCURACY = 1500[source]¶
telegram.constants.LocationLimit.HORIZONTAL_ACCURACYAdded in version 20.0.
- MAX_HEADING = 360[source]¶
telegram.constants.LocationLimit.MAX_HEADINGAdded in version 20.0.
- MIN_HEADING = 1[source]¶
telegram.constants.LocationLimit.MIN_HEADINGAdded in version 20.0.