Wiki source code of positions/get_pos_data.php

Last modified by YellowFox_RD on 2025/03/05 13:14

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