Skip to main content
Version: 2.0.19

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.

let result = SkyPath.shared.turbulence(with: TurbulenceQuery())
switch result {
case .success(let turbResult):
let geoJSON = turbResult.geoJSON
// Show GeoJSON on the map
case .failure(let error):
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.

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)
let result = SkyPath.shared.turbulencePolygons(with: query)
switch result {
case .success(let turbResult):
let geoJSON = turbResult.geoJSON
map.updateTurbulence(with: geoJSON)
case .failure(let error):
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.