Array
extension Array where Element == CLLocationCoordinate2D
public extension Array where Element == LiveFlight
public extension Array where Element == NowcastItem
public extension Array where Element == TurbulenceItem
-
Generates a geodesic polyline coordinates using
MapKit.MKGeodesicPolyline
.When a line crosses Antimerdian it will have longitude from both sides, like +179° and -179°. This leads to a drawing over the whole globe.
The result coordinates will be normalized into [-360°,0°] or [0°, +360°] longitude range. Warning. Longitude below -180° or above +180° is not a valid coordinate so the map library or parser could throw an error.
Declaration
Swift
public var geodesic: [CLLocationCoordinate2D] { get }
-
Generates a corridor polygon.
Declaration
Swift
public func buffer(widthNM: Double, simplify: Bool = true, tolerance: Double = 0.1) -> [CLLocationCoordinate2D]
Parameters
widthNM
The width of corridor in nautical miles.
simplify
If the polygon should be simplified.
true
by default.tolerance
Controls the level of simplification by specifying the maximum allowed distance between the original line point and the simplified point. A higher tolerance value results in higher simplification.
0.1
is good for server fetch and0.01
is good for drawing on the map. The default is0.1
. -
Simplifies the polygon.
Declaration
Swift
public func simplify(tolerance: Double = 0.1) -> [CLLocationCoordinate2D]
Parameters
tolerance
Controls the level of simplification by specifying the maximum allowed distance between the original line point and the simplified point. A higher tolerance value results in higher simplification. The default is 0.1.
-
Finds an intersection between two polygons.
Declaration
Swift
public func intersection(with polygon: [CLLocationCoordinate2D]) -> [CLLocationCoordinate2D]?
Parameters
polygon
The polygon to check intersection with.
-
Smooth the polygon using the Ramer–Douglas–Peucker algorithm.
Performed on the caller queue and when lot of coordinates it could take some time, so using a background queue is recommended.
Declaration
Swift
public func smoothed(iterations: Int = 1) -> [CLLocationCoordinate2D]
Parameters
iterations
Controls the level of smoothness. A higher number results in higher smoothness. The default is 1.
-
Converts the array of
LiveFlight
to a valid GeoJSON that can be visualized on the map.Can be used when you have a custom filtering of
LiveFlight
but need a GeoJSON for the map.Declaration
Swift
func geoJSON() -> String
-
Converts the array of
NowcastItem
to a valid GeoJSON that can be visualized on the map.Declaration
Swift
func geoJSON() -> String
-
Converts the array of
TurbulenceItem
to a valid GeoJSON that can be visualized on the map.Can be used when you have a custom filtering of
TurbulenceItem
but need a GeoJSON for the map.Declaration
Swift
func geoJSON(withType type: TurbulenceResultType) -> String
Parameters
type
The feature geometry of turbulence in GeoJSON can be different for own (circle) and server (hexagon) turbulence.