Collection

public extension Collection where Element: GeoCoordinate

Available where Element: GeoCoordinate

  • Creates a bounding box from a collection of GeoCoordinates.

    Declaration

    Swift

    func bounds() -> GeoBounds

    Return Value

    The 2D representation of the bounding box as GeoBounds value.

  • Creates a MKPolyline form a collection of GeoCoordinates

    Important: Only available on iOS and macOS targets.

    Declaration

    Swift

    var polyLine: MKPolyline { get }
  • Creates a CGPath form a collection of GeoCoordinates using an MKMPolylineRenderer. Nil if no path could be created.

    Important: Only available on iOS and macOS targets.

    Declaration

    Swift

    var path: CGPath? { get }
  • Creates a path from the collection of GeoCoordinates. Useful if you want to draw a 2D image of a track.

    Declaration

    Swift

    func path(normalized: Bool = true) -> CGPath

    Parameters

    normalized

    Flag indicating if the paths values should be normalized into the range 0…1. If true, the resulting values in the path are mapped to value in 0…1 coordinates space, otherwise the values from the geo coordinates. Defaults to true.

    Return Value

    A CGPath containing a projected 2D-representation of the geo coordinates.

  • Helper for removing points from a collection if the are closer than a specified threshold.

    Important: The elevation value of the returned Coordinate array is always zero.

    Declaration

    Swift

    func removeIf(closerThan meters: Double) -> [Coordinate]

    Parameters

    meters

    The threshold predicate in meters for removing points. A point is removed if it is closer to its predecessor than this value.

    Return Value

    An array of Coordinate values, each having a minimum distance to their predecessors of least closerThan meters.