PositionObject

Objective-C


@interface PositionObject : NSObject

Swift

class PositionObject : NSObject

This class encapsulates position information.

  • New position object.

    Declaration

    Objective-C

    + (nullable PositionObject *)createPosition:(NSInteger)timestamp
                                       latitude:(double)latitude
                                      longitude:(double)longitude
                                       altitude:(double)altitude
                                         course:(double)course
                                          speed:(double)speed
                                  speedAccuracy:(double)speedAccuracy
                             horizontalAccuracy:(double)horizontalAccuracy
                               verticalAccuracy:(double)verticalAccuracy
                                 courseAccuracy:(double)courseAccuracy;

    Swift

    class func createPosition(_ timestamp: Int, latitude: Double, longitude: Double, altitude: Double, course: Double, speed: Double, speedAccuracy: Double, horizontalAccuracy: Double, verticalAccuracy: Double, courseAccuracy: Double) -> PositionObject?

    Parameters

    timestamp

    The acquisition timestamp.

    latitude

    The latitude in degrees.

    longitude

    The longitude in degrees.

    altitude

    The altitude in meters.

    course

    The course in degrees.

    speed

    The speed in mps.

    speedAccuracy

    The speed accuracy in mps.

    horizontalAccuracy

    The horizontal accuracy in meters.

    verticalAccuracy

    The vertical accuracy in meters.

    courseAccuracy

    The course accuracy in meters.

  • Initializes and returns a newly allocated object using the model data.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithModelData:(nonnull void *)data;
  • Returns the model data.

    Declaration

    Objective-C

    - (nonnull void *)getModelData;
  • Initializes and returns a newly allocated object using the data object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDataObject:(nonnull DataObject *)data;

    Swift

    init(dataObject data: DataObject)
  • Returns the model data object.

    Declaration

    Objective-C

    - (nullable DataObject *)getDataObject;

    Swift

    func getDataObject() -> DataObject?
  • Satellite timestamp, milliseconds since 1970. @details Timestamps are expected to increase monotonously for subsequent positions; data with timestamp from the past will be discarded.

    Declaration

    Objective-C

    - (NSInteger)getSatelliteTime;

    Swift

    func getSatelliteTime() -> Int

    Return Value

    The satellite time in milliseconds.

  • Returns the provider type.

    Declaration

    Objective-C

    - (PositionProvider)getProvider;

    Swift

    func getProvider() -> PositionProvider
  • Geographical latitude. @details From -90 to +90; positive on northern hemisphere. @details If value is out of the -90…90 range, the position is considered invalid.

    Declaration

    Objective-C

    - (double)getLatitude;

    Swift

    func getLatitude() -> Double

    Return Value

    The latitude in degrees.

  • Geographical longitude. @details From -180 to +180; positive on eastern hemisphere. @details If value is out of the -180…180 range, the position is considered invalid.

    Declaration

    Objective-C

    - (double)getLongitude;

    Swift

    func getLongitude() -> Double

    Return Value

    The longitude in degrees.

  • Latitude and longitude. @details If both values are equal to 0, the position is considered invalid.

    Declaration

    Objective-C

    - (nonnull CoordinatesObject *)getCoordinates;

    Swift

    func getCoordinates() -> CoordinatesObject

    Return Value

    Coordinate pair, each one in degrees.

  • Altitude above main sea level.

    Declaration

    Objective-C

    - (double)getAltitude;

    Swift

    func getAltitude() -> Double

    Return Value

    The altitude in meters.

  • Travel speed. @details Valid speed information should always be non-negative. @details A negative value (-1 by default) means the position has no speed information. @details If car is going backwards, the course should change by 180, but the speed should still be non-negative.

    Declaration

    Objective-C

    - (double)getSpeed;

    Swift

    func getSpeed() -> Double

    Return Value

    The speed, in m/s.

  • Travel speed accuracy. @details Typical accuracy for consumer GPS is 2 m/s at steady speed and high position accuracy. @details Valid speed accuracy should always be positive.

    Declaration

    Objective-C

    - (double)getSpeedAccuracy;

    Swift

    func getSpeedAccuracy() -> Double

    Return Value

    The speed accuracy in m/s.

  • The course of the movement. @details Represents true heading, not magnetic heading. @details 0 means true north, 90 east, 180 south, 270 west. @details A negative value (-1 by default) means the position has no course information.

    Declaration

    Objective-C

    - (double)getCourse;

    Swift

    func getCourse() -> Double

    Return Value

    The course in degrees.

  • Course accuracy. @details Typical accuracy for consumer GPS is 25 degrees at high speeds. @details Valid course accuracy should always be positive.

    Declaration

    Objective-C

    - (double)getCourseAccuracy;

    Swift

    func getCourseAccuracy() -> Double

    Return Value

    The course accuracy in degrees.

  • Horizontal accuracy of position. @details Typical accuracy for consumer GPS is 5-20 meters. @details Valid position accuracy should always be positive.

    Declaration

    Objective-C

    - (double)getHorizontalAccuracy;

    Swift

    func getHorizontalAccuracy() -> Double

    Return Value

    The horizontal position accuracy in meters.

  • Vertical accuracy of position. @details Valid position accuracy should always be positive.

    Declaration

    Objective-C

    - (double)getVerticalAccuracy;

    Swift

    func getVerticalAccuracy() -> Double

    Return Value

    The vertical position accuracy in meters.

  • Fix quality (whether this position is trustworthy).

    Declaration

    Objective-C

    - (PositionFixQuality)getFixQuality;

    Swift

    func getFixQuality() -> PositionFixQuality

    Return Value

    The fix quality.

  • Returns true if position is valid.

    Declaration

    Objective-C

    - (BOOL)isValid;

    Swift

    func isValid() -> Bool
  • Query if this object has valid coordinates.

    Declaration

    Objective-C

    - (BOOL)hasCoordinates;

    Swift

    func hasCoordinates() -> Bool

    Return Value

    True if latitude and longitude are available and valid, false if not.

  • Query if this object has altitude.

    Declaration

    Objective-C

    - (BOOL)hasAltitude;

    Swift

    func hasAltitude() -> Bool

    Return Value

    True if altitude is available and valid, false if not.

  • Query if this object has speed.

    Declaration

    Objective-C

    - (BOOL)hasSpeed;

    Swift

    func hasSpeed() -> Bool

    Return Value

    True if speed is available and valid, false if not.

  • Query if this object has speed accuracy.

    Declaration

    Objective-C

    - (BOOL)hasSpeedAccuracy;

    Swift

    func hasSpeedAccuracy() -> Bool

    Return Value

    True if speed accuracy is available and valid, false if not.

  • Query if this object has course.

    Declaration

    Objective-C

    - (BOOL)hasCourse;

    Swift

    func hasCourse() -> Bool

    Return Value

    True if course is available and valid, false if not.

  • Query if this object has course accuracy.

    Declaration

    Objective-C

    - (BOOL)hasCourseAccuracy;

    Swift

    func hasCourseAccuracy() -> Bool

    Return Value

    True if course accuracy is available and valid, false if not.

  • Query if this object has horizontal accuracy.

    Declaration

    Objective-C

    - (BOOL)hasHorizontalAccuracy;

    Swift

    func hasHorizontalAccuracy() -> Bool

    Return Value

    True if horizontal accuracy is available and valid, false if not.

  • Query if this object has vertical accuracy.

    Declaration

    Objective-C

    - (BOOL)hasVerticalAccuracy;

    Swift

    func hasVerticalAccuracy() -> Bool

    Return Value

    True if vertical accuracy is available and valid, false if not.

  • Get data type.

    Declaration

    Objective-C

    - (DataType)getType;

    Swift

    func getType() -> DataType
  • Check if improved position has a road localization.

    Declaration

    Objective-C

    - (BOOL)hasRoadLocalization;

    Swift

    func hasRoadLocalization() -> Bool
  • Get position road address info.

    Declaration

    Objective-C

    - (nonnull NSString *)getRoadAddressFieldNameWithType:
        (AddressSearchFieldType)type;

    Swift

    func getRoadAddressFieldName(with type: AddressSearchFieldType) -> String
  • Get position road modifiers as an integer of packed RoadModifier flags.

    Declaration

    Objective-C

    - (int)getRoadModifier;

    Swift

    func getRoadModifier() -> Int32
  • Get position road speed limit in m/s. @details If speed limit doesn’t exist in map data, 0 is returned.

    Declaration

    Objective-C

    - (double)getRoadSpeedLimit;

    Swift

    func getRoadSpeedLimit() -> Double
  • Get position road info details. @details The road info list is in ascending priority order.

    Declaration

    Objective-C

    - (nonnull NSArray<RoadInfoObject *> *)getRoadInfo;

    Swift

    func getRoadInfo() -> [RoadInfoObject]
  • Get road info image.

    Declaration

    Objective-C

    - (nullable UIImage *)getRoadCodeImage:(CGSize)size;

    Swift

    func getRoadCodeImage(_ size: CGSize) -> UIImage?

    Parameters

    size

    The image size in pixels.

  • Get road info image.

    Declaration

    Objective-C

    - (nullable UIImage *)getRoadCodeImage:(CGSize)size
                                     scale:(CGFloat)scale
                                       ppi:(NSInteger)ppi;

    Swift

    func getRoadCodeImage(_ size: CGSize, scale: CGFloat, ppi: Int) -> UIImage?

    Parameters

    size

    The image size in pixels.

    scale

    The screen scale factor.

    ppi

    The screen pixel per inch.

  • Check if position has terrain data.

    Declaration

    Objective-C

    - (BOOL)hasTerrainData;

    Swift

    func hasTerrainData() -> Bool
  • Returns the terrain altitude. @details This a map data based value comparing to getAltitude which is GPS sensor data.

    Declaration

    Objective-C

    - (double)getTerrainAltitude;

    Swift

    func getTerrainAltitude() -> Double
  • Returns the terrain slope. @details The current slope in degrees, positive value for ascent, negative for descent.

    Declaration

    Objective-C

    - (double)getTerrainSlope;

    Swift

    func getTerrainSlope() -> Double
  • Returns the travel speed formatted string.

    Declaration

    Objective-C

    - (nonnull NSString *)getFormattedSpeed;

    Swift

    func getFormattedSpeed() -> String
  • Returns the travel speed unit formatted string.

    Declaration

    Objective-C

    - (nonnull NSString *)getFormattedSpeedUnit;

    Swift

    func getFormattedSpeedUnit() -> String