Skip to main content
Version: 2.1.4

Get Data

Turbulence

SDK fetches data from the server and caches it locally automatically.

Use TurbulenceQuery to get filtered data as a GeoJSON string or as an array of objects. It will query locally cached data received previously. It blocks the current thread, so using a separate background thread is recommended.

do {
let result = try SkyPath.shared.turbulence(with: TurbulenceQuery()).get()
let geoJSON = result.geoJSON
// Show GeoJSON on the map
} catch {
print(error)
}

SkyPath.shared.dataHistoryTime determines the data history be fetched from the server. By default, it is .twoHours. So if it was not changed and query for .fourHours for example, there will be data only up to 2 hours because no more data was fetched from the server.

H3 resolution 5 is used by SkyPath for the turbulence reports area. Each turbulence report covers ~252.9 square km hexagon area (as per the H3 resolutions table) and 1000 feet of altitude. Each hexagon is connected to the other so this allows for covering the area better. So one turbulence report covers for example FL370..<FL380 or FL380..<FL390.

In order to get reports for specific tiles use TurbulenceQuery.tiles property. It accepts h3 or h3-alt format. Such tile id can be taken from TurbulenceItem.tile property which is a Tile object with the corresponding properties Tile.key and Tile.keyByCoord or Tile.h3Hex.

Turbulence Polygons

Use TurbulencePolygonsQuery to get filtered data as a GeoJSON string. It will query locally cached data received previously. It blocks the current thread, so using a separate background thread is recommended.

let query = TurbulencePolygonsQuery(altRange: 0...52_000)
do {
let result = try SkyPath.shared.turbulencePolygons(with: query).get()
let geoJSON = result.geoJSON
// Show GeoJSON on the map
} catch {
print(error)
}

SkyPath.shared.dataHistoryTime determines the data history be fetched from the server. By default it is .twoHours. So if it was not changed there are no polygons data for .fourHours for example. This is because polygons data is generated per each history time separately, so SDK needs to have it cached to return.

When Offline

When offline there could be situations where the global turbulence polygons have been fetched but the turbulence reports are not for the specific viewport when moving the map. It is possible to use turbulence polygons data instead. Set TurbulenceQuery.usePolygonsEnabled to use polygons data to return data in a query instead of having empty data.