Type Definitions
General Types
HexId
The HexId is a string that represents the H3 hexagon id of resolution 0 or 1.
type HexId = string;
const hexId = "8027fffffffffff"
ChildPosition
The ChildPosition is a string that represents the H3 hexagon child position of resolution 5.
type ChildPosition = string;
const childPosition = "904"
Timestamp
The Timestamp is a number that represents the Unix timestamp in seconds.
type Timestamp = number;
const timestamp = 1736851773;
Point
The Point is an array of two numbers that represents a point on the map.
type Point = [number, number]; // [latitude, longitude]
const point = [ -64.816, -18.751 ]
Polygon
Requirements:
- follow the type definition below;
- at least 4 points;
- the last point should be the same as the first point.
type Polygon = Array<Point>;
const polygon = [
[ -64.816, -18.751 ],
[ -64.816, -28.452 ],
[ -51.672, -28.452 ],
[ -51.672, -18.751 ],
[ -64.816, -18.751 ]
]
Altitude
The Altitude is a number that represents the altitude in thousands of feet.
type Altitude = number; // from 5 to 52 only
const altitude = 38;
Severity
The Severity is a number from 0 to 4 that represents the severity level, where 0 is smooth and 4 is severe.
enum Severity {
SMOOTH = 0,
LIGHT = 1,
LIGHT_MODERATE = 2,
MODERATE = 3,
MODERATE_SEVERE = 4
}
const severity = 0; // Severity.SMOOTH
Forecast
The Forecast is a number from 0 to 12 that represents the forecast in hours.
type Forecast = number;
const forecast = 6;
EDR
The EDR is an aircraft-independent measure of turbulence represented as a number from 0 to 1
type EDR = number;
const edr = 0.146;
AircraftCategory
The aircraftCategory is a string literal type that represents the aircraft category.
- The available values are from
C10toC110with a step of10;
type AircraftCategory = "C10" | "C20" | "C30" | "C40" | "C50" | "C60" | "C70" | "C80" | "C90" | "C100" | "C110"
const aircraftCategory = "C10"
hoursAgo
The hoursAgo is a string type that determent when a report is due to expire.
- so we get 2 reports, one is 45 minutes old, and the other is 75 minutes old, and
hoursAgois set to"1", the report that is 75 minutes old will be filtered out, as all reports older than 60 minutes
type hoursAgo = "0.5" | "1" | "2" | "4"
OneLayer Types
nowcastingAlt
Unlike OneLayer, nowcasting will show only 1 altitude. nowcastingAlt is a number type that will show the selected altitude.
- this will be a number between 5 and 52, the default value is 35, that is 35,000 feet.
type nowcastingAlt = number // 5 - 52
sources
The sources is an array of numbers that represents the sources of the report.
- The sources are represented by the following numbers:
- 0: NOWCASTING
- 1: OBSERVATIONS
- 2: PIREPS
- 3: EDR
- 4: ADSB
type sources = [0, 1, 2, 3, 4]
OneLayerData
The OneLayerData is an object with a set of functions that allows to get observations data emitted by the OneLayerFlow in different three formats.
- Raw reports
- Hexagons
- GeoJSON
type Report = {
hexId: ChildPosition,
alt: Altitude,
edr: EDR,
sev: Severity,
sources: Sources,
observationTime: Timestamp, // when the report was reported
usedSource: number, // the source that is most relevenat and effects sev | edr | usedSourceTs
usedSourceTs: Timestamp // when the usedSource was reported
};
type OneLayersData = Record<HexId, Array<Report>>;
const oneLayersData: OneLayersData = {
// ...
"8027fffffffffff": [
{
hexId: 3934,
alt: 31,
edr: 0.23,
sev: 2,
sources: [4, 1],
observationTime: 1736851773,
usedSource: 4,
usedSourceTs: 1736851150
}
]
}
type Hexagon = {
hexId: ChildPosition,
alt: Altitude,
edr: EDR,
sev: Severity,
sources: Sources,
observationTime; Timestamp,
usedSource; number,
usedSourceTs; Timestamp,
};
type HexagonsArray = Array<Hexagon>;
const hexagons: HexagonsArray = [
// ...
{
hexId: '852a9a83fffffff',
alt: 37,
edr: 0.1,
sev: 1,
sources: [4],
observationTime: 1742288997,
usedSource: 4,
usedSourceTs: 1742288997,
},
// ...
]
type Properties = {
hexId: HexId;
sev: Severity;
alt: Altitude;
observationTime: Timestamp;
};
type Geometry = {
type: "Polygon";
coordinates: Array<Array<Point>>;
};
type FeatureCollection = {
type: "FeatureCollection";
features: Array<{
type: "Feature";
id: HexId;
properties: Properties;
geometry: Geometry;
}>;
};
const featureCollection: FeatureCollection = {
"type": "FeatureCollection",
"features": [
// ...
{
"type": "Feature",
"id": "8526552bfffffff",
"properties": {
"hexId": "8526552bfffffff",
"sev": 1,
"alt": 30,
"observationTime": 1741784362
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-91.93945313563029,
38.281289113822226
],
[
-91.86636783494598,
38.34622566917388
],
[
-91.90464006584331,
38.4321948734724
],
[
-92.01618907853218,
38.453250299545346
],
[
-92.08933669686661,
38.38826957837179
],
[
-92.05087318404611,
38.30227766412111
],
[
-91.93945313563029,
38.281289113822226
]
]
]
}
},
// ...
]
}
Observations Types
ObservationsData
The ObservationsData is an object with a set of functions that allows to get observations data emitted by the ObservationsFlow in different three formats.
type ObservationsData = {
toRawObject: () => RawReportsData,
toHexagonsArray: () => HexagonsArray,
toFeatureCollection: () => FeatureCollection,
};
- Raw reports
- Hexagons
- GeoJSON
type Report = {
hexId: ChildPosition;
observationTime: Timestamp;
edr: EDR;
sev: Severity;
alt: Altitude;
};
type RawReportsData = Record<HexId, Array<Report>>;
const rawReports: RawReportsData = {
// ...
"8027fffffffffff": [
{
hexId: "3934",
edr: 0.14662447257383968,
observationTime: 1736851773,
sev: 2,
alt: 31
}
],
// ...
}
type Hexagon = {
hexId: HexId;
observationTime: Timestamp;
edr: EDR;
sev: Severity;
alt: Altitude;
};
type HexagonsArray = Array<Hexagon>;
const hexagons: HexagonsArray = [
// ...
{
hexId: "8526552bfffffff",
alt: 30,
sev: 1,
edr: 0.08,
observationTime: 1741784362
},
// ...
]
type Properties = {
hexId: HexId;
sev: Severity;
alt: Altitude;
observationTime: Timestamp;
};
type Geometry = {
type: "Polygon";
coordinates: Array<Array<Point>>;
};
type FeatureCollection = {
type: "FeatureCollection";
features: Array<{
type: "Feature";
id: HexId;
properties: Properties;
geometry: Geometry;
}>;
};
const featureCollection: FeatureCollection = {
"type": "FeatureCollection",
"features": [
// ...
{
"type": "Feature",
"id": "8526552bfffffff",
"properties": {
"hexId": "8526552bfffffff",
"sev": 1,
"alt": 30,
"observationTime": 1741784362
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-91.93945313563029,
38.281289113822226
],
[
-91.86636783494598,
38.34622566917388
],
[
-91.90464006584331,
38.4321948734724
],
[
-92.01618907853218,
38.453250299545346
],
[
-92.08933669686661,
38.38826957837179
],
[
-92.05087318404611,
38.30227766412111
],
[
-91.93945313563029,
38.281289113822226
]
]
]
}
},
// ...
]
}
ADS-B Types
ADSBData
The ADSBData is an object that represents the data that is emitted by the ADSBFlow.
type Report = {
hexId: ChildPosition;
observationTime: Timestamp;
sev: Severity;
alt: Altitude;
};
type ADSBData = Record<HexId, Array<Report>>;
const adsbData: ADSBData = {
"8027fffffffffff": [
{
hexId: "3934",
observationTime: 1736851773,
sev: 2,
alt: 31
}
]
}
Nowcasting Types
NowcastingData
The NowcastingData is an object that represents the data that is emitted by the NowcastingFlow.
type NowcastingData = {
toRawObject: () => RawReportsData,
toHexagonsArray: () => HexagonsArray,
toFeatureCollection: () => FeatureCollection,
};
- Raw reports
- Hexagons
- GeoJSON
type Report = {
alt: Altitude;
sev: Severity;
forecast: Forecast;
hexIds: Array<ChildPosition>;
}
type NowcastingData = Record<HexId, Array<Report>>;
const rawReports: RawReportsData = {
// ...
"8027fffffffffff": [
{
alt: 38,
sev: 2,
forecast: 3,
hexIds: ["3934"]
}
]
// ...
}
type Hexagon = {
hexId: HexId;
forecast: Forecast;
sev: Severity;
alt: Altitude;
};
type HexagonsArray = Array<Hexagon>;
const hexagons: HexagonsArray = [
// ...
{
hexId: "8526552bfffffff",
alt: 30,
sev: 2,
forecast: 3
},
// ...
]
type Properties = {
hexId: HexId;
sev: Severity;
alt: Altitude;
forecast: Forecast;
};
type Geometry = {
type: "Polygon";
coordinates: Array<Array<Point>>;
};
type FeatureCollection = {
type: "FeatureCollection";
features: Array<{
type: "Feature";
id: HexId;
properties: Properties;
geometry: Geometry;
}>;
};
const featureCollection: FeatureCollection = {
"type": "FeatureCollection",
"features": [
// ...
{
"type": "Feature",
"id": "8526552bfffffff",
"properties": {
"hexId": "8526552bfffffff",
"sev": 1,
"alt": 30,
"forecast": 3
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-91.93945313563029,
38.281289113822226
],
[
-91.86636783494598,
38.34622566917388
],
[
-91.90464006584331,
38.4321948734724
],
[
-92.01618907853218,
38.453250299545346
],
[
-92.08933669686661,
38.38826957837179
],
[
-92.05087318404611,
38.30227766412111
],
[
-91.93945313563029,
38.281289113822226
]
]
]
}
},
// ...
]
}