DataTypes.ts 3.01 KB
Newer Older
Hanadi's avatar
Hanadi committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
export type GeoProximity = {
    latitude: number;
    longitude: number;
    distance: number;
}

export type UnitsType = "metric" | "imperial";

export type FlowResponse = {
    /**
     * A list of Roadway (RW) items.
     */
    RWS: Roadways[];
    /**
     * Units of measurements used for flow items.
     */
    UNITS: UnitsType
}

export type Roadways = {
    /**
     * This is the composite item for flow across an entire roadway.
     * A roadway item will be present for each roadway with traffic flow information available.
     */
    RW: Roadway[];
    /**
     * Units of measurements used for flow items in this RWS element.
     */
    UNITS: UnitsType
}

export type Roadway = {
    /**
     * A list of Flow Item (FI) elements
     */
    FIS: FlowItems[];
    /**
     * Unique string identifier for this Linear
     */
    LI: string;
    /**
     * Text description of the road
     */
    DE: string;
    /**
     * Basetimestamp used as a reference for all predictive calculations in this Roadway
     */
    PBT: string;
}

export type FlowItems = {
    /**
     * A single flow item.
     */
    FI: FlowItem[];
}

export type FlowItem = {
    /**
     * An ordered collection of TMC locations.
     */
    TMC: TMCType;
    /**
     * Current Flow. This element contains details about speed and Jam Factor information for the given flow item.
     */
    CF: CFType[];
    /**
     * A list of the flow item segments.
     */
    SHP?: SegmentInformation[];
}

export type SegmentInformation = {
    /**
     * A value of the points in the segment represented as lat,lon string separated by spaces.
     * E.g. "48.78905,9.18971 48.78916,9.18932 48.78919,9.1892 48.78921,9.1891 "
     */
    value: string;
}

export type TMCType = {
    /**
     * Point TMC Location Code
     */
    PC: number;
    /**
     * Description for the given location.
     */
    DE: string;
    /**
     * Queuing direction. '+' or '-'. Note this is the opposite of the travel direction in the fully qualified ID,
     * for example for location 107+03021 the QD would be '-'.
     */
    QD: "+" | "-";
    /**
     * Length of item (based on UNITS)
     */
    LE: number;
}

export type CFType = {
    /**
     * Used when it is needed to differentiate between different kinds of location types.
     */
    TY: string;
    /**
     * Speed (based on UNITS) capped by speed limit.
     */
    SP: number;
    /**
     * Speed (based on UNITS) not capped by speed limit
     */
    SU: number;
    /**
     * The free flow speed on this stretch of road.
     */
    FF: number;
    /**
     * The number between 0.0 and 10.0 indicating the expected quality of travel. When there is a road closure, the Jam Factor will be 10.
     * As the number approaches 10.0 the quality of travel is getting worse. -1.0 indicates that a Jam Factor could not be calculated.
     */
    JF: number;
    /**
     * Confidence, an indication of how the speed was determined. -1.0 road closed. 1.0=100% 0.7-100% Historical Usually a value between .7 and 1.0.
     */
    CN: number;
}