TurbulenceQuery

public struct TurbulenceQuery

Use TurbulenceQuery to get filtered data as an array of TurbulenceItem objects or a GeoJSON string.

It will query locally cached data received previously. Used in SkyPath.turbulence(with:).

  • Type of the turbulence data whether it’s from the server or own tracked. See TurbulenceResultType for more details.

    The default is server.

    Declaration

    Swift

    public var type: TurbulenceResultType
  • An altitude range to query. Should be round to a thousand feet.

    The default is 0…52000. Measured in feet.

    Declaration

    Swift

    public var altRange: ClosedRange<Double>?
  • How to provide queried data.

    The default is geoJSON.

    Declaration

    Swift

    public var resultOptions: TurbulenceResultOptions
  • Aggregate turbulence by the tile to have only one most severe turbulence per tile.

    Each hexagon can have multiple reports left for it because multiple flights crossed this hexagon. By default, TurbulenceQuery has aggregate = true which means you’ll get one TurbulenceItem per hexagon (tile) with the most severe report for this hexagon.

    The default is true.

    Declaration

    Swift

    public var aggregate: Bool
  • Array of a tile key generated by Tile.key or Tile.keyByCoord. Use it to query turbulence in the specific tiles.

    Declaration

    Swift

    public var tiles: [String]?
  • History time to query data for.

    When it’s nil the SkyPath.dataHistoryTime value is used. Optional.

    Declaration

    Swift

    public var dataHistoryTime: DataHistoryTime?
  • Turbulence severities to query.

    When it’s nil the DataQuery.sevs will be used. Optional.

    Declaration

    Swift

    public var sevs: [TurbulenceSeverity]?
  • Min severity level of turbulence.

    Optional. The default is nil.

    Declaration

    Swift

    public var minSev: TurbulenceSeverity?
  • A route line coordinates. Should be used in conjunction with widthAround.

    When it’s nil the DataQuery.route will be used. Typically you don’t need to set it. Optional.

    Will query for data within the route corridor based on route and widthAround. If it is different from DataQuery.polygon there could be no data locally to query.

    Declaration

    Swift

    public var route: [CLLocationCoordinate2D]?
  • A distance around route to build a route corridor.

    Measured in nautical miles (NM). Optional.

    Declaration

    Swift

    public var widthAround: Double?
  • Polygon is a geo-fence area to fetch data inside only.

    Should be a closed ring. By default, it uses DataQuery.polygon. Typically you don’t need to set it. Optional.

    It is possible to set a custom polygon but the query is made among the locally stored data received by DataQuery configuration. So if the polygons are different there could be no data available locally.

    Declaration

    Swift

    public var polygon: [CLLocationCoordinate2D]?
  • By default it’s false and only route corridor and viewport low-resolution H3 turbulence reports will be queried.

    But when offline and no low-resolution turbulence reports are cached it could be useful to show high-resolution turbulence polygons on the map instead. In this case, set it to true and the query will return a TurbulenceItem array generated from turbulence polygons cached for the specified area.

    It will use polygons data only if no low-resolution H3 turbulence reports meet the query. A recommendation for when to use it is when the app is offline.

    Optional. By default, it is false.

    Declaration

    Swift

    public var usePolygonsEnabled: Bool
  • Default initializer.

    Declaration

    Swift

    public init(type: TurbulenceResultType = .server,
                altRange: ClosedRange<Double>? = nil,
                resultOptions: TurbulenceResultOptions = .geoJSON,
                aggregate: Bool = true,
                tiles: [String]? = nil,
                dataHistoryTime: DataHistoryTime? = nil)

    Parameters

    type

    See TurbulenceResultType for available options. The default is server.

    altRange

    When it’s nil all altitudes are used. Measured in feet. Optional.

    resultOptions

    See TurbulenceResultOptions for available options. The default is geoJSON.

    aggregate

    Aggregate reports per tile, taking the highest severity. The default is true.

    tiles

    Array of tile keys generated by Tile.key or Tile.keyByCoord. Use it to query turbulence in the specific tiles. Optional.

    dataHistoryTime

    History time to query data for. When it’s nil the SkyPath.dataHistoryTime value is used. Optional.