Class LocationContext

Hierarchy

Constructors

Properties

_client: Evogram
_source: ILocation
source: ILocation = ...

Accessors

  • get heading(): undefined | number
  • Returns the heading of the device when the location data was recorded.

    Returns undefined | number

    The heading in degrees, where 0 degrees represents true north.

  • get livePeriod(): undefined | number
  • Returns the time period during which the location data is considered "live".

    Returns undefined | number

    The live period in seconds.

  • get proximityAlertRadius(): undefined | number
  • Returns the proximity alert radius for the location.

    Returns undefined | number

    The proximity alert radius in meters.

Methods

  • Calculates the bearing (in degrees) between this location and another location.

    Parameters

    • other: ILocation

      The other location to calculate the bearing to

    Returns number

    The bearing in degrees, where 0 degrees is due north

  • Calculates the distance between this location and another location specified as a parameter. The Haversine formula is used, which takes into account the curvature of the Earth's surface.

    Parameters

    • other: ILocation

      The other location to calculate the distance to

    Returns number

    The distance between the two locations in meters

  • Checks if this location has an accuracy radius that is smaller than or equal to a specified maximum value. A location is considered accurate if it has a horizontal_accuracy property that is defined and is less than or equal to the specified maximum value.

    Parameters

    • maxAccuracy: number

      The maximum accuracy radius in meters

    Returns boolean

    True if this location is accurate, false otherwise

  • Checks if this location is a live location that can be updated. A location is considered live if it has a live_period property greater than 0.

    Returns boolean

    True if this is a live location, false otherwise

  • Checks if this location is within a specified radius around another location.

    Parameters

    • center: ILocation

      The center location to measure the distance from

    • radius: number

      The radius in meters

    Returns boolean

    True if this location is within the radius around the center location, false otherwise

  • Converts the source object to a context object of a given type.

    Example

    client.updates.on("message", message => {
    const user = message.user.toContext<CustomUserContext>();
    // Now user works correctly with your context
    })

    Type Parameters

    • TContext extends object

      Generic type parameter for the context object.

    Returns TContext

    The context object.

Generated using TypeDoc