Coordinate

public final class Coordinate : Decodable, Sendable
extension Coordinate: Equatable
extension Coordinate: CustomDebugStringConvertible
extension Coordinate: CustomStringConvertible
extension Coordinate: Hashable
  • Declaration

    Swift

    public let location: CLLocation
  • Declaration

    Swift

    public let levels: [Float]
  • height from the floor of the defined level. Must be nil outdoor.

    Declaration

    Swift

    public let heightFromFloor: CLLocationDistance?
  • height from the ground of the defined level. Must be nil outdoor.

    Declaration

    Swift

    public let heightFromGround: CLLocationDistance?
  • Declaration

    Swift

    public var coordinate2D: CLLocationCoordinate2D { get }
  • Declaration

    Swift

    public var latitude: CLLocationDegrees { get }
  • Declaration

    Swift

    public var longitude: CLLocationDegrees { get }
  • Declaration

    Swift

    public var direction: CLLocationDirection? { get }
  • Altitude from sea level expressed in meters.

    Declaration

    Swift

    public var altitude: CLLocationDistance? { get }
  • Declaration

    Swift

    public var isIndoor: Bool { get }
  • Declaration

    Swift

    public var isOutdoor: Bool { get }
  • Declaration

    Swift

    public var cartesian: Double3 { get }
  • Declaration

    Swift

    public var ecef: Double3 { get }
  • Declaration

    Swift

    public var latitudeRadians: Double { get }
  • Declaration

    Swift

    public var longitudeRadians: Double { 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,
        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

    Stackoverflow

    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 Backend

    Declaration

    Swift

    public func distance(to coordinate: Coordinate) -> CLLocationDistance?

    Parameters

    coordinate

    The destination coordiante.

    Return Value

    The distance (in meters) between the two coordinates. Nil if coordinates are at different levels

  • 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

Equatable

  • 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

CustomDebugStringConvertible

  • Declaration

    Swift

    public var debugDescription: String { get }

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }

Hashable

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)

Copying

  • Declaration

    Swift

    func copy(location: CLLocation? = nil, levels: [Float]? = nil) -> Coordinate
  • Declaration

    Swift

    func copy(coordinate2D: CLLocationCoordinate2D? = nil, altitude: CLLocationDistance? = nil, levels: [Float]? = nil) -> Coordinate

Rotations