DATEX II MST Traffic Data Interface methodology
The DATEX II MST Traffic Data Interface is based on two main phases:
- Anagraphic data load, contained in the file measurement_current.xml.
- Traffic data load, contained in the file trafficspeed.xml.
Important: No specific assumptions can be made about the provisioning process that provide you these XML files.
The XML files involved can be downloaded here.
You can download:
- measurement_current.xml.gz
- trafficspeed.xml.gz
The first phase is based on some necessary configuration steps (see → DATEX II MST Traffic Data Interface configuration).
This phase is based on a API endpoint that loads data through the file:
measurement_current.xml.gz
This file is used as payload of the request.
POST datex2import/optima/measureTable
Example of request:
https://<OPTIMA_HOST_IP_ADDRESS>:<PORT_NUMBER>/datex2import/optima/measureTable
Response status
| HTTP status | Description |
|---|---|
|
200 OK |
Result of the processed request. |
|
400 Bad request |
The request does not contain the payload ( file measurement_current.xml.gz). |
The outcome of this operation is to fill the DATEX2_MEASUREMENT_SITE_TABLE.
According to the fragment of file indicate in → Example of measurement_current.xml, we must have in the DB (see → DATEX II MST Traffic Data Interface configuration):
- a count location with name PZH01_MST_0687_01
- a detector with name lane1
-
a VEHICLE_CLASS_TSYS table with a data record set through the query:
INSERT INTO vehicle_class_tsys (lmin, lmax, vehicle_type, tsys) VALUES (NULL, 5.600000, '', 'CAR_TO_PCU_Traffic_Data');
The result is a data record in DATEX2_MEASUREMENT_SITE_TABLE:
| Field | Value |
|---|---|
|
table_id |
NDW01_MT |
|
table_version |
1135 |
|
publication_time |
|
|
site_id |
PZH01_MST_0687_01 |
|
site_version |
8 |
|
site_name |
N450 km 2.735 |
|
version_time |
|
|
Nlane |
1 |
|
Indx |
1 |
|
Accuracy |
95 |
|
period |
60 |
|
lane |
lane1 |
|
vehicle_class_tsys |
1 |
|
value_type |
traffic_flow |
Important: Before to load traffic data, is necessary to create the DB tables TRAFFICSTATE_DATEX2 and TRAFFICSTATE_DATEX2_RLTM (see → Traffic states and real-time traffic states – TRAFFICSTATE table, TRAFFICSTATE_RLTM table).
This phase is based on a API endpoint that loads data through the file:
trafficspeed.xml.gz.
POST datex2import/optima/MeasurementsZip
Example of request:
https://<OPTIMA_HOST_IP_ADDRESS>:<PORT_NUMBER>/datex2import/optima/MeasurementsZip
Response status
| HTTP status | Description |
|---|---|
|
200 OK |
Result of the processed request. |
|
400 Bad request |
The request does not contain the payload ( file trafficspeed.xml.gz). |
In order to successfully load traffic data it’s necessary the matching of the id and version attributes of the tags:
- <measurementSiteRecord> in measurement_current.xml (see → Example of measurement_current.xml).
- <measurementSiteReference> in trafficspeed.xml (see → Example of trafficspeed.xml).
| measurement_current.xml | trafficspeed.xml |
|---|---|
|
<measurementSiteRecord> tag
|
<measurementSiteReference> tag
|
If this matching fails, the data record is not loaded.
<measurementSiteTable id="NDW01_MT" version="1135">
<measurementSiteRecord id="PZH01_MST_0687_01" version="8">
<measurementSiteRecordVersionTime>2019-08-30T00:14:07Z</measurementSiteRecordVersionTime>
<computationMethod>arithmeticAverageOfSamplesInATimePeriod</computationMethod>
<measurementEquipmentReference>0687_01</measurementEquipmentReference>
<measurementEquipmentTypeUsed>
<values>
<value lang="nl">lus</value>
</values>
</measurementEquipmentTypeUsed>
<measurementSiteName>
<values>
<value lang="nl">N450 km 2.735</value>
</values>
</measurementSiteName>
<measurementSiteNumberOfLanes>1</measurementSiteNumberOfLanes>
<measurementSide>northEastBound</measurementSide>
<measurementSpecificCharacteristics index="1">
<measurementSpecificCharacteristics>
<accuracy>95</accuracy>
<period>60</period>
<specificLane>lane1</specificLane>
<specificMeasurementValueType>trafficFlow</specificMeasurementValueType>
<specificVehicleCharacteristics>
<lengthCharacteristic>
<comparisonOperator>lessThan</comparisonOperator>
<vehicleLength>5.6</vehicleLength>
</lengthCharacteristic>
</specificVehicleCharacteristics>
</measurementSpecificCharacteristics>
........
....
<siteMeasurements
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<measurementSiteReference id="PZH01_MST_0687_01" version="8" targetClass="MeasurementSiteRecord"/>
<measurementTimeDefault>2019-10-25T13:23:00Z</measurementTimeDefault>
<measuredValue index="1">
<measuredValue>
<basicData xsi:type="TrafficFlow">
<vehicleFlow>
<vehicleFlowRate>360</vehicleFlowRate>
</vehicleFlow>
</basicData>
</measuredValue>
</measuredValue>
....
<measuredValue index="5">
<measuredValue>
<basicData xsi:type="TrafficSpeed">
<averageVehicleSpeed numberOfInputValuesUsed="6" standardDeviation="8.77">
<speed>65</speed>
</averageVehicleSpeed>
</basicData>
</measuredValue>
</measuredValue>
</siteMeasurements>