Coordinate
public final class Coordinate : Decodable, Sendable
extension Coordinate: Equatable
extension Coordinate: CustomDebugStringConvertible
extension Coordinate: CustomStringConvertible
extension Coordinate: ShortStringConvertible
extension Coordinate: Hashable
-
Declaration
Swift
public let location: CLLocation -
Sorted array of indoor levels. Empty if the coordinate is outdoor.
In case of a level range, the array will contain two elements, the lowest level first and the highest level second.
Examples:
[0],[-1, 1]Declaration
Swift
public let levels: [Float] -
Height from the floor of the defined level.
Must be
niloutdoor.Declaration
Swift
public let heightFromFloor: CLLocationDistance? -
Height from the ground of the defined level.
Must be
niloutdoor.Declaration
Swift
public let heightFromGround: CLLocationDistance? -
The geographical coordinate information.
Declaration
Swift
public var coordinate2D: CLLocationCoordinate2D { get } -
The latitude in degrees.
Positive values indicate latitudes north of the equator. Negative values indicate latitudes south of the equator.
Declaration
Swift
public var latitude: CLLocationDegrees { get } -
The longitude in degrees.
Measurements are relative to the zero meridian, with positive values extending east of the meridian and negative values extending west of the meridian.
Declaration
Swift
public var longitude: CLLocationDegrees { get } -
The altitude above mean sea level associated with a location, measured in meters.
The altitude property represents an orthometric height, which is the height above the approximate mean sea level. Positive values indicate altitudes above mean sea level. Negative values indicate altitudes below mean sea level.
When
verticalAccuracycontains 0 or a negative number, the value of altitude is invalid. The value of altitude is valid whenverticalAccuracycontains a postive number.Declaration
Swift
public var altitude: CLLocationDistance? { get }Return Value
nilif altitude information is missing or invalid -
The direction in which the device is traveling, measured in degrees and relative to due north.
Direction values are measured in degrees starting at due north and continue clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on.
Declaration
Swift
public var direction: CLLocationDirection? { get }Return Value
nilif direction information is missing or invalid -
The radius of uncertainty for the location, measured in meters.
The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the latitude and longitude are invalid.
Declaration
Swift
public var horizontalAccuracy: CLLocationAccuracy { get } -
Declaration
Swift
public var isIndoor: Bool { get } -
Declaration
Swift
public var isOutdoor: Bool { get } -
The latitude in radians.
Declaration
Swift
public var latitudeRadians: Double { get } -
The longitude in radians.
Declaration
Swift
public var longitudeRadians: Double { get } -
Declaration
Swift
public var cartesian: Double3 { get } -
Declaration
Swift
public var ecef: Double3 { get } -
Declaration
Swift
public required init(from decoder: Decoder) throws -
Declaration
Swift
public init(location: CLLocation, levels: [Float] = [], heightFromFloor: CLLocationDistance? = nil, heightFromGround: CLLocationDistance? = nil) -
Declaration
Swift
public convenience init( coordinate2D: CLLocationCoordinate2D, altitude: CLLocationDistance? = nil, horizontalAccuracy: CLLocationAccuracy? = nil, levels: [Float] = [], heightFromFloor: CLLocationDistance? = nil, heightFromGround: CLLocationDistance? = nil ) -
Declaration
Swift
public convenience init(coordinate2D: CLLocationCoordinate2D, altitude: CLLocationDistance? = nil, level: Float) -
Declaration
Swift
public convenience init(latitude: CLLocationDegrees, longitude: CLLocationDegrees, altitude: CLLocationDistance? = nil, levels: [Float] = []) -
Declaration
Swift
public convenience init(latitude: CLLocationDegrees, longitude: CLLocationDegrees, altitude: CLLocationDistance? = nil, level: Float) -
Declaration
Swift
public convenience init(ecef: Double3, levels: [Float] = [], heightFromFloor: CLLocationDistance? = nil, heightFromGround: CLLocationDistance? = nil) -
Declaration
Swift
public convenience init(cartesian: Double3, levels: [Float] = []) -
Adapted to cartesian coordinates using Spherical model
Seealso
Note
Ellipsoid model using ECEF seems to not work due to Earth radius factor
Declaration
Swift
public func getSegmentProjection(segment: Segment) -> Coordinate? -
Returns the Haversine distance (measured in meters) from the current object’s coordinate to the specified coordinate.
Note
Here we don’t use iOS default
location.distance(from: other.location)because it gives a bit different results comparing to Android and BackendDeclaration
Swift
public func distance(to coordinate: Coordinate, formula: DistanceFormula = .haversineWithLevels) -> CLLocationDistance?Parameters
coordinateThe destination coordiante.
formulaThe desired formula to calculate distance. Default is
.haversineWithLevelsReturn Value
The distance (in meters) between the two coordinates. Nil if coordinates are at different levels when used
.haversineWithLevelsformula. -
Returns the Haversine distance (measured in meters) from the current object’s coordinate to the specified coordinate.
This is equivalent to calling
distance(to: other, method: .haversine)Note
Here we don’t use iOS default
location.distance(from: other.location)because it gives a bit different results comparing to Android and BackendDeclaration
Swift
public func distance2D(to coordinate: Coordinate) -> CLLocationDistanceParameters
coordinateThe destination coordiante.
Return Value
The distance (in meters) between the two coordinates
-
Returns the Haversine distance (measured in meters) from the current object’s coordinate to the specified coordinate taking altitude into account.
This is equivalent to calling
distance(to: other, method: .haversineWithAltitude)Important
If altitude is missing even for the one of two coordinates, it will not be taken into account.
Note
Here we don’t use iOS default
location.distance(from: other.location)because it gives a bit different results comparing to Android and BackendDeclaration
Swift
public func distance3D(to coordinate: Coordinate) -> CLLocationDistanceParameters
coordinateThe destination coordiante.
Return Value
The distance (in meters) between the two coordinates
-
Returns the direction from the receiver to the given coordinate.
Declaration
Swift
public func direction(to coordinate: Coordinate) -> CLLocationDirection -
Returns a coordinate a certain Haversine distance away in the given direction.
Declaration
Swift
public func coordinate(at distance: CLLocationDistance, facing direction: CLLocationDirection) -> Coordinate
-
Declaration
Swift
public static func == (lhs: Coordinate, rhs: Coordinate) -> Bool -
Declaration
Swift
public static func equals(_ lhs: Coordinate, _ rhs: Coordinate, eps: Double = GeoConstants.EPS_DEGREES, epsAlt: Double = GeoConstants.EPS_METERS) -> Bool -
Declaration
Swift
public func equals(_ rhs: Coordinate, eps: Double = GeoConstants.EPS_DEGREES, epsAlt: Double = GeoConstants.EPS_METERS) -> Bool
-
Declaration
Swift
public var debugDescription: String { get }
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public var shortDescription: String { get }
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
func copy(location: CLLocation? = nil, levels: [Float]? = nil) -> Coordinate -
Declaration
Swift
func copy( coordinate2D: CLLocationCoordinate2D? = nil, altitude: CLLocationDistance? = nil, horizontalAccuracy: CLLocationAccuracy? = nil, levels: [Float]? = nil ) -> Coordinate
-
Declaration
Swift
var ecefToEnuRot: Quaternion { get } -
Declaration
Swift
var enuToEcefRot: Quaternion { get } -
Declaration
Swift
var ecefToEusRot: Quaternion { get } -
Declaration
Swift
var eusToEcefRot: Quaternion { get }
View on GitHub