Skip to content
  • Location
  • class Esri::ArcGISRuntime::Location

    Represents a location update from a position source. More...

    Header: #include <Location.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherited By:

    Esri::ArcGISRuntime::NmeaLocation

    Public Functions

    Location(const Esri::ArcGISRuntime::Point &position, double horizontalAccuracy, double velocity, double course, bool lastKnown)
    (since Esri::ArcGISRuntime 100.8) Location(const QDateTime &timestamp, const Esri::ArcGISRuntime::Point &position, double horizontalAccuracy, double verticalAccuracy, double velocity, double course, bool lastKnown)
    (since Esri::ArcGISRuntime 100.14) Location(const QDateTime &timestamp, const Esri::ArcGISRuntime::Point &position, double horizontalAccuracy, double verticalAccuracy, double velocity, double course, bool lastKnown, const QVariantMap &additionalSourceProperties)
    Location(const Esri::ArcGISRuntime::Location &other)
    Location(Esri::ArcGISRuntime::Location &&other)
    virtual ~Location()
    (since Esri::ArcGISRuntime 100.14) QVariantMap additionalSourceProperties() const
    double course() const
    double horizontalAccuracy() const
    bool isEmpty() const
    bool isLastKnown() const
    (since Esri::ArcGISRuntime 100.10) Esri::ArcGISRuntime::LocationType locationType() const
    Esri::ArcGISRuntime::Point position() const
    (since Esri::ArcGISRuntime 100.8) QDateTime timestamp() const
    double velocity() const
    (since Esri::ArcGISRuntime 100.8) double verticalAccuracy() const
    Esri::ArcGISRuntime::Location &operator=(Esri::ArcGISRuntime::Location &&other)
    Esri::ArcGISRuntime::Location &operator=(const Esri::ArcGISRuntime::Location &other)

    Detailed Description

    Relevant samples:

    See also LocationDisplay.

    Member Function Documentation

    Location::Location(const Esri::ArcGISRuntime::Point &position, double horizontalAccuracy, double velocity, double course, bool lastKnown)

    Creates a location object.

    • position - A Point geometry object.
    • horizontalAccuracy - The horizontal accuracy in meters. Positive values or NaN are supported.
    • velocity - The location's velocity in meters per second.
    • course - The location's course in degrees (clockwise), 0 being True-North.
    • lastKnown - Indicates whether this is an outdated device position retrieved and cached earlier and therefore not guaranteed to represent the current location. Setting this to true will render with the LocationDisplay::acquiringSymbol, typically a grayed out location symbol.

    [since Esri::ArcGISRuntime 100.8] Location::Location(const QDateTime &timestamp, const Esri::ArcGISRuntime::Point &position, double horizontalAccuracy, double verticalAccuracy, double velocity, double course, bool lastKnown)

    Creates a location object with timestamp.

    • timestamp - A timestamp when the location was received.
    • position - A Point geometry object.
    • horizontalAccuracy - The horizontal accuracy in meters. Positive values or NaN are supported.
    • verticalAccuracy - The vertical accuracy in meters. Positive values or NaN are supported.
    • velocity - The location's velocity in meters per second.
    • course - The location's course in degrees (clockwise), 0 being True-North.
    • lastKnown - Indicates whether this is an outdated device position retrieved and cached earlier and therefore not guaranteed to represent the current location. Setting this to true will render with the LocationDisplay::acquiringSymbol, typically a grayed out location symbol.

    This function was introduced in Esri::ArcGISRuntime 100.8.

    [since Esri::ArcGISRuntime 100.14] Location::Location(const QDateTime &timestamp, const Esri::ArcGISRuntime::Point &position, double horizontalAccuracy, double verticalAccuracy, double velocity, double course, bool lastKnown, const QVariantMap &additionalSourceProperties)

    Creates a location object with timestamp and additional source properties.

    • timestamp - A timestamp when location was received.
    • position - A point geometry object.
    • horizontalAccuracy - The horizontal accuracy in meters. Positive values or NaN are supported.
    • verticalAccuracy - The vertical accuracy in meters. Positive values or NaN are supported.
    • velocity - The location's velocity in meters-per-second.
    • course - The location's course in degrees (clockwise), 0 being True-North.
    • lastKnown - Indicates whether this is an outdated device position retrieved and cached earlier and therefore not guaranteed to represent the current location. Setting this to true will render with the LocationDisplay::acquiringSymbol, typically a grayed out location symbol.
    • additionalSourceProperties - A set of key-value pairs providing additional meta-data and properties about the source of this Location.

    A Location can be created from a variety of sources and using different technologies. By supplying additionalSourceProperties you can allow users of this Location to find out how the data was captured.

    Information should be provided as a set of key-value pairs, where the QString key describes the type of data held in the QVariant value. Values must be basic data types such as string, floating point, integer, boolean or date. You can use any string for the key - but this API recognizes a number of well known keys which should be used if available. See LocationSourcePropertiesKeys:

    • "floor" (an integer value). The floor number of the Location when in a building. Use LocationSourcePropertiesKeys::floor to reference this key.
    • "satelliteCount" (an integer value). The number of satellites used to fix the Location. Use LocationSourcePropertiesKeys::satelliteCount to reference this key.
    • "transmitterCount" (an integer value). The number of transmitters used to create an indoor positioning system (IPS) position. Use LocationSourcePropertiesKeys::transmitterCount to reference this key.
    • "positionSource" (a string value). This key can be used to indicate the position source: GNSS, AppleIPS, BLE, WIFI, CELL, IP. GNSS indicates global navigation satellite system and AppleIPS is Apple’s indoor positioning technology. It is possible to have multiple position sources. In that case positionSource is a list with comma-separated values.
    • "floorLevelId" (a string value). Unique ID of the feature stored in the levels ArcGISFeatureTable in accordance with the ArcGIS Indoors Information Model. Use LocationSourcePropertiesKeys::floorLevelId to reference this key.

      Keys are case-sensitive.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    See also additionalSourceProperties.

    Location::Location(const Esri::ArcGISRuntime::Location &other)

    Copy constructor from other Location.

    [noexcept] Location::Location(Esri::ArcGISRuntime::Location &&other)

    Move constructor from other Location.

    [virtual noexcept] Location::~Location()

    Destructor.

    [since Esri::ArcGISRuntime 100.14] QVariantMap Location::additionalSourceProperties() const

    Returns a set of key-value pairs that provide additional metadata, such as source and accuracy details of this Location.

    When a Location is created, implementation-specific or platform-specific details about the location may be added to this dictionary of additional source properties. This information is provided as a set of key-value pairs, where the (case-sensitive) QString key describes the type of data held in the QVariant value. Values are basic data types such as string, numeric, boolean, or date.

    The specific keys and corresponding values available in the dictionary are determined by the location provider. However, this API recognizes the following well-known keys and exposes them through the LocationSourcePropertiesKeys class:

    The availability of these values depends on the location provider and platform. IndoorsLocationDataSource provides values for floor, floorLevelId, positionSource, and either transmitterCount or satelliteCount, depending on the underlying system data source. The location data source provides different values depending on the platform. For example, on iOS, it provides a value for floor and on Android, it provides values for positionSource and satelliteCount. Values reported via Android's ref-external@[Location.getExtras()](https://developer.android.com/reference/android/location/Location#getExtras()) are also included in the additional source properties dictionary.

    For developers wanting to derive their own IndoorsLocationDataSource, additionalSourceProperties provides a means to include extra information with each Location.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    See also LocationSourcePropertiesKeys.

    double Location::course() const

    Gets the direction in which the device is traveling.

    The direction is measured in degrees starting at due north and continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on. Course values may not be available on all devices. A negative value indicates that the direction is invalid.

    This property will return NaN when the object is empty.

    double Location::horizontalAccuracy() const

    Gets the radius of uncertainty for the location, measured in meters.

    The position identifies the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the position is invalid.

    This property will return NaN when the object is empty.

    bool Location::isEmpty() const

    Returns true if this Location is empty.

    bool Location::isLastKnown() const

    Gets whether the location information is current or based on a last known update.

    Returns true if it is based on last known update. It is considered to be of last known update once the LocationDisplay::acquiringTimeout has passed without an update.

    In the case of an empty Location, this will return false.

    [since Esri::ArcGISRuntime 100.10] Esri::ArcGISRuntime::LocationType Location::locationType() const

    Returns the type of the location.

    This property will return Unknown when the object is empty.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also LocationType.

    Esri::ArcGISRuntime::Point Location::position() const

    Gets the coordinates of the position as a Point.

    This property will return a default constructed Point when the object is empty.

    [since Esri::ArcGISRuntime 100.8] QDateTime Location::timestamp() const

    The time this location was observed.

    This property will return a default constructed QDateTime when the object is empty.

    This function was introduced in Esri::ArcGISRuntime 100.8.

    double Location::velocity() const

    Gets the instantaneous speed of the device in meters per second.

    This property will return NaN when the object is empty.

    [since Esri::ArcGISRuntime 100.8] double Location::verticalAccuracy() const

    The vertical accuracy of the location in meters.

    This property will return NaN when the object is empty.

    This function was introduced in Esri::ArcGISRuntime 100.8.

    [noexcept] Esri::ArcGISRuntime::Location &Location::operator=(Esri::ArcGISRuntime::Location &&other)

    Move operator from other Location.

    Esri::ArcGISRuntime::Location &Location::operator=(const Esri::ArcGISRuntime::Location &other)

    Assignment operator from other Location.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.