Skip to main content
Version: Current

Geolocation Types

  • Geolocation

    Defines the possible geolocation results.

    A Geolocation can be one of the following values:

  • SuccessfulGeolocation

    Defines an interface that represents a successful geolocation result.

    Members

    • altitude? number

      The altitude that the device is near. Null if the device does not support determining the altitude.

    • altitudeAccuracy? number

      The accuracy of the altitude in meters. Null if the device does not support altitude.

    • heading number

      The heading of the device from north in radians. 0 is true north, Math.PI/2 is east, Math.PI is south and 3/2*Math.PI is west. This value is null if the device is unable to determine the heading.

    • latitude? number

      The latitude that the device is near.

    • longitude? number

      The longitude that the device is near.

    • positionalAccuracy? number

      The accuracy of the positional location (latitude and longitude) in meters.

    • speed number

      The speed that the device is moving in meters per second. Null if the device does not support calculating the speed.

    • success true

    • timestamp number

      The timestamp of the geolocation result.

  • UnsuccessfulGeolocation

    Defines an interface that represents an unsuccessful geolocation result.

    Members

    • errorCode? ("unknown" | "permission_denied" | "position_unavailable" | "timeout")

      The code of the error that occurred.

    • errorMessage? string

      The message of the error that occurred.

    • success false

  • ConvertGeolocationToWhat3WordsOptions

    Defines an interface that represents options for converting a geolocation to a what3words address.

    Members

    • language? string

      The identifier of the language that should be used for the resulting what3words address.

    • latitude number

      The latitude to convert.

    • longitude number

      The longitude to convert.

  • ConvertGeolocationToWhat3WordsAction

    Defines an interface that represents an action that converts a geolocation (latitude and longitude) to a what3words address (see https://what3words.com/).

    Members

    • language? string

      The identifier of the language that should be used for the resulting what3words address.

    • latitude number

      The latitude to convert.

    • longitude number

      The longitude to convert.

    • playerId? string

      The ID of the player that created this task. Set by remote action handlers when a task is recieved from a remote player.

    • taskId (string | number)

      The ID of the async task.

    • type "convert_geolocation_to_w3w"

      The type of the event. This helps determine how the event should be applied to the state.

    • uncopiable? boolean

      Whether the action can be structure cloned. If true, then the action should not be passed across message ports without special handling.

  • GetGeolocationAction

    An event that is used to retrieve the current geolocation of the device.

    Members

    • playerId? string

      The ID of the player that created this task. Set by remote action handlers when a task is recieved from a remote player.

    • taskId (string | number)

      The ID of the async task.

    • type "get_geolocation"

      The type of the event. This helps determine how the event should be applied to the state.

    • uncopiable? boolean

      Whether the action can be structure cloned. If true, then the action should not be passed across message ports without special handling.