Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# Location

class telegram.Location(longitude, latitude, horizontal_accuracy=None, live_period=None, heading=None, proximity_alert_radius=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This 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 `longitude` and `latitude` are equal.

  Parameters:

    - longitude (`float`) – Longitude as defined by sender.

    - latitude (`float`) – Latitude as defined by sender.

    - horizontal_accuracy (`float`, optional) – The radius of uncertainty for the location, measured in meters; 0-`1500`.

    - live_period (`int`, optional) – Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only.

    - 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.

  longitude

    Longitude as defined by sender.

    Type:

      `float`

  latitude

    Latitude as defined by sender.

    Type:

      `float`

  horizontal_accuracy

    Optional. The radius of uncertainty for the location, measured in meters; 0-`1500`.

    Type:

      `float`

  live_period

    Optional. Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only.

    Type:

      `int`

  heading

    Optional. The direction in which user is moving, in degrees; `1`-`360`. For active live locations only.

    Type:

      `int`

  proximity_alert_radius

    Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.

    Type:

      `int`

  Use In

  - `telegram.Bot.edit_message_live_location()`

  - `telegram.Bot.send_location()`

  Available In

  - `telegram.ChatLocation.location`

  - `telegram.ChosenInlineResult.location`

  - `telegram.ExternalReplyInfo.location`

  - `telegram.InlineQuery.location`

  - `telegram.Message.location`

  - `telegram.Venue.location`

  HORIZONTAL_ACCURACY = 1500

    `telegram.constants.LocationLimit.HORIZONTAL_ACCURACY`

    New in version 20.0.

  MAX_HEADING = 360

    `telegram.constants.LocationLimit.MAX_HEADING`

    New in version 20.0.

  MIN_HEADING = 1

    `telegram.constants.LocationLimit.MIN_HEADING`

    New in version 20.0.