Wiki source code of positions/get_pos_data.php

Last modified by Dominic Lippmann on 2025/03/05 13:14

Show last authors
1 (% class="box" %)
2 (((
3 Table of Contents
4 )))
5
6 {{toc/}}
7
8 Return the position data of a single vehicle or vehicle group.
9 If no date is given, it will return the current position.
10
11 = Description =
12
13 (% class="green mark" %)**GET**(%%)** positions/get_pos_data.php?company**=//COMPANY_RTIKEY//**&vehicle**=//VEHICLE_RTIKEY//**&start**=//YYYY-MM-DDTHH:MM:SS+HH:MM**&end**//=//YYYY-MM-DDTHH:MM:SS+HH:MM//
14
15 = Parameter =
16
17 |=parameter|=description|=type|=hint|=mandatory
18 |company|RTI company key|string| |yes
19 |vehicle|RTI vehicle key|string|either vehicle or group parameter| (yes)
20 |group|RTI group key|string|either vehicle or group parameter| (yes)
21 |start|start of query date range|datestring|Format: ISO 8601 (//YYYY-MM-DDTHH:MM:SS+HH:mm//)|no
22 |end|end of query date range|datestring|Format: ISO 8601 (//YYYY-MM-DDTHH:MM:SS+HH:mm//)|no
23 |query_date|point of time to get the position for|datestring|Format: ISO 8601 (//YYYY-MM-DDTHH:MM:SS+HH:mm//)|no
24 |format|output format|string|json (default)|no
25 |date_type|Which date is the base for date restriction?|string|'insert' (default) = execution date
26 'gps' = date when the messaged was generated|no
27 |additional_data|additional parameters to gather more data|string[]|(((
28 * 'temp' gathers the value if digital temperature sensors 1-8 and analogue temperature sensors 1-4
29 * 'trailer' gathers all the trailer informations
30 )))|no
31 |hide_display|hide position messages generated by connected display|int|(((
32 * 0 (default) = display messages are being returned
33 * 1 = display messages are not being returned
34 )))|no
35 |offset|The request returns 5000 data records at max. Use offset to access the next block.|int| |no
36
37 (% class="box" %)
38 (((
39 **Hint for date restriction**
40 You can use 3 different modes
41 a) Use start and end and get all positions within this timerange (the difference  between these dates can not be more than 24 hours)
42 b) Just use query_date to get the most current position message of each vehicle at this point of time
43 c) Use no date parameter to just get the most current message of each vehicle right now
44 )))
45
46 = Output =
47
48 A **string** is being returned. Will return "(% class="error" %)**ERROR:description**(%%)" on error.
49
50 == Field descriptions ==
51
52 |=Field|=Description
53 |vehicle_sign|vehicle sign
54 |rti_ident|RTI ident
55 |insert_date|When was this message processed by YellowFox?
56 |gps_date|When was this message sent by the vehicle?
57 |lat|latitude
58 |lon|logitude
59 |text_position|text address of GPS position
60 |customer|customer name (if the address belongs to a customer)
61 |direction|direction in degree
62 |satellites|number of satellites used for getting GPS position
63 |speed|speed in km/h
64 |ignition|Is ignition on (1) or off (0)?
65 |reason|Why was this position message sent?
66 |km|odometer
67 |bszX|value of operating hours counter
68 |driver_X|name of driver
69 |driverkey_X|personnel key of driver
70 |eta_time|If navigating to a target: planned arrival
71 |eta_distance|If navigating to a target: remaining distance
72 |eta_duration|If navigating to a target: remaining duration
73 |eta_lat|If navigating to a target: latitude of target
74 |eta_lon|If navigating to a target: longitude of target
75 |eta_desc|If navigating to a target: text address of target
76 |digital_inputs|(((
77 status of telemetry inputs
78 nr = number of input (1 to 7)
79 name = name of input
80 state = status of input as text
81 value =  status of input (1 = on, 0 = off)
82
83 ident = technical attribute, can be set via object-specific settings
84 )))
85 |trailer_info|Optional field. Includes information about connected trailer.
86 date = date of status
87 type = connected to trailer (TRAILER) or towing vehicle (VEHICLE)
88 name = name of connected trailer / towing vehicle
89 rti_ident = RTI Ident of connected trailer
90 state = connection state (CONNECTED or DISCONNECTED)
91 |digital_temperature_values|Optional field. Includes digital temperature data.
92 nr = number of input
93 value = temperature in °C
94 set_point = target value in °C
95 |analogue_temperature_values|Optional field. Includes analogue temperature data.
96 nr = number of input
97 value = temperature in °C
98
99 == JSON ==
100
101 You can find a JSON schema description for this result set [[here>>https://map.yellowfox.de/rti/schema/get_pos_data_schema.json]].
102
103 {{code language="java"}}
104 {    
105 "_date" => null,
106 "_links" => {
107 "next" => {
108 "href" => null
109 }
110 },
111 "has_more" => false,    
112 "items": [
113 {
114 "vehicle_sign": "FTL YF 123",
115 "rti_ident": "",
116 "insert_date": "2022-09-22T13:23:35+02:00",
117 "gps_date": "2022-09-22T13:23:23+02:00",
118 "lat": 48.20398,
119 "lon": 16.22613,
120 "text_position": "A-1140 Wien (Penzing) Wientalstraße (B1)",
121 "customer": null,
122 "direction": 155,
123 "satellites": 12,
124 "speed": 0,
125 "ignition": 0,
126 "reason": "AnalogMinuteInterval",
127 "km": 361549,
128 "bsz1": null,
129 "bsz2": null,
130 "driver_1": null,
131 "driverkey_1": null,
132 "driver_2": null,
133 "driverkey_2": null,
134 "eta_time": null,
135 "eta_distance": null,
136 "eta_duration": null,
137 "eta_lat": null,
138 "eta_lon": null,
139 "eta_desc": null,
140 "digital_inputs": [
141 {
142 "nr": 2,
143 "name": "Sensor 2",
144 "state": "",
145 "value": 0,
146 "ident": null
147 }
148 ],
149 "trailer_info": {
150 "date": "2022-09-22T13:18:35+02:00",
151 "type": "TRAILER",
152 "name": "Trailer 123",
153 "rti_ident": "TR_ID",
154 "state":"CONNECTED"
155 },
156 "digital_temperature_values": [
157 {
158 "nr": 1,
159 "value": 13.2,
160 "set_point": 13.3
161 }
162 ],
163 "analogue_temperature_values": [
164 {
165 "nr": 1,
166 "value": 21.56
167 },
168 {
169 "nr": 2,
170 "value": 11.83
171 }
172 ]
173 }
174 ]
175 }
176 {{/code}}
177
178 = example calls =
179
180 **Query date range for a group**
181 {{code language="java"}}https://map.yellowfox.de/rti/positions/get_pos_data.php?company=COMPANY_RTIKEY&group=GROUP_RTIKEY&start=2022-09-22T13:23:00%2B00:00:00&end=2022-09-22T14:23:00%2B00:00:00&additional_data[]=temp{{/code}}
182
183 **Query fixed date for a vehicle**
184 {{code language="java"}}https://map.yellowfox.de/rti/positions/get_pos_data.php?company=COMPANY_RTIKEY&vehicle=VEHICLE_RTIKEY&query_date=2022-09-22T13:23:00%2B00:00:00{{/code}}
185
186 **Query current point of time for a vehicle with RTI ident**
187 {{code language="java"}}https://map.yellowfox.de/rti/positions/get_pos_data.php?company=COMPANY_RTIKEY&vehicle={"type":"car_ident","groupKey":"GROUP_RTIKEY","ident":"VEHICLE_IDENT"}{{/code}}