HERE iOS SDK Developer's Guide

NMAGeoCoordinates

Class Summary

class NMAGeoCoordinates

Derived from: NSObject, <NSCoding>

Represents WGS84 coordinates with double precision.

Include: NMAKit.framework/headers/NMAGeoCoordinates.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for NMAGeoCoordinates

[For complete information, see the section Class Details]

Public Property Summary

Table 1. Public Properties
Public Properties

[readable, writable, assign] float  altitude

The altitude of the NMAGeoCoordinates measured in meters above sea-level.

[readable, writable, assign] double  latitude

The latitude, as measured in degrees, representing north-south coordinate (y-axis on a map)

[readable, writable, assign] double  longitude

The longitude, as measured in degrees, representing east-west coordinate (x-axis on a map)

Instance Method Summary

Table 2. Instance Methods
Instance Method Summary

-(double) distanceTo:(nonnull NMAGeoCoordinates *) coordinates

Calculates (using the Haversine formula) the distance in meters between this NMAGeoCoordinates instance and the specified NMAGeoCoordinates

-(double) headingTo:(nonnull NMAGeoCoordinates *) coordinates

Calculates the heading in degrees from this NMAGeoCoordinates instance to the specified NMAGeoCoordinates instance

-(nonnull instancetype) init

-(nonnull instancetype) initWithLatitude:(double) latitude longitude:(double) longitude

Initializes an NMAGeoCoordinates instance with specified latitude and longitude values and NMAGeoCoordinatesUnknownAltitudeValue altitude

-(nonnull instancetype) initWithLatitude:(double) latitude longitude:(double) longitude altitude:(float) altitude

Initializes an NMAGeoCoordinates instance with specified values for the initial latitude, longitude and altitude

-(BOOL) isEqualToGeoCoordinates:(nonnull NMAGeoCoordinates *) coordinates

Determines whether this NMAGeoCoordinates is equal to another

Class Method Summary

Table 3. Class Methods
Class Methods

+(nonnull instancetype) geoCoordinatesWithLatitude:(double) latitude longitude:(double) longitude

Constructs a NMAGeoCoordinates with the specified latitude and longitude

+(nonnull instancetype) geoCoordinatesWithLatitude:(double) latitude longitude:(double) longitude altitude:(double) altitude

Constructs a NMAGeoCoordinates with the specified latitude, longitude, and altitude

Class Details

Represents WGS84 coordinates with double precision. A NMAGeoCoordinates encapsulates a latitude and longitude value, plus an optional altitude value.

Note:

Although NMAGeoCoordinates are accepted and handled with double precision (about 15 significant digits), the real precision of rendering operations such as NMAMapView::setCenterAt might be lower due to internal conversions. Overall precision of NMAGeoCoordinates can be assured for only six digits following the decimal point.

Public Property Details

[readable, writable, assign] float altitude

The altitude of the NMAGeoCoordinates measured in meters above sea-level.

By default, the plane of the map is at 0 meters. Thus, geocoordinates with positive altitudes represent points above the plane of the map, while negative altitudes are below the plane of the map. Map objects with these coordinates will be displayed accordingly.

Note:

Valid values are in the range [-10000.0, 10000.0]. If an invalid value is specified, it will be adjusted to the closest possible valid value (e.g. a specified value of -10200.0 will be set to -10000.0).

Note:

NMAGeoCoordinatesUnknownAltitudeValue if altitude is unknown.

[readable, writable, assign] double latitude

The latitude, as measured in degrees, representing north-south coordinate (y-axis on a map).

Note:

The latitude must be in the range [-90, 90]. Values outside this range will be clamped.

[readable, writable, assign] double longitude

The longitude, as measured in degrees, representing east-west coordinate (x-axis on a map).

Note:

The longitude must be in the range [-180, 180]. Values outside this range will be wrapped. For example, a value of 200 degrees will be wrapped to -160.

Instance Method Details

-(double) distanceTo:(nonnull NMAGeoCoordinates *) coordinates

Calculates (using the Haversine formula) the distance in meters between this NMAGeoCoordinates instance and the specified NMAGeoCoordinates.

Parameters:

  • coordinates

    A second NMAGeoCoordinates some distance away

Returns:

The distance between the NMAGeoCoordinates, or NMAGeoCoordinatesInvalidValue if the coordinates parameter is nil

-(double) headingTo:(nonnull NMAGeoCoordinates *) coordinates

Calculates the heading in degrees from this NMAGeoCoordinates instance to the specified NMAGeoCoordinates instance.

Parameters:

Returns:

Heading from this coordinate to the given coordinate, in degrees. 0 = north, increasing clockwise. If coordinates is nil, NMAGeoCoordinatesInvalidValue will be returned to indicate an error.

-(nonnull instancetype) init

Initializes an NMAGeoCoordinates instance with latitude 0 and longitude 0

-(nonnull instancetype) initWithLatitude:(double) latitude longitude:(double) longitude

Initializes an NMAGeoCoordinates instance with specified latitude and longitude values and NMAGeoCoordinatesUnknownAltitudeValue altitude.

Parameters:

  • latitude

    An initial latitude value. Values outside of [-90, 90] will be clamped to that range (100 becomes 90).

  • longitude

    An initial longitude value. Values outside of [-180, 180] will be wrapped to that range (200 becomes -160).

Returns:

The NMAGeoCoordinates instance, or nil if initialization failed

-(nonnull instancetype) initWithLatitude:(double) latitude longitude:(double) longitude altitude:(float) altitude

Initializes an NMAGeoCoordinates instance with specified values for the initial latitude, longitude and altitude.

Parameters:

  • latitude

    An initial latitude value

  • longitude

    An initial longitude value

  • altitude

    An initial altitude value

Returns:

The NMAGeoCoordinates instance, or nil if initialization failed

-(BOOL) isEqualToGeoCoordinates:(nonnull NMAGeoCoordinates *) coordinates

Determines whether this NMAGeoCoordinates is equal to another.

Coordinates are considered equal if the distance between them is <= 1M. Altitude is not considered.

Returns:

YES if the coordinates are equal, NO otherwise

Class Method Details

+(nonnull instancetype) geoCoordinatesWithLatitude:(double) latitude longitude:(double) longitude

Constructs a NMAGeoCoordinates with the specified latitude and longitude.

Parameters:

  • latitude

    An initial latitude value

  • longitude

    An initial longitude value

+(nonnull instancetype) geoCoordinatesWithLatitude:(double) latitude longitude:(double) longitude altitude:(double) altitude

Constructs a NMAGeoCoordinates with the specified latitude, longitude, and altitude.

Parameters:

  • latitude

    An initial latitude value

  • longitude

    An initial longitude value

  • altitude

    An initial altitude value