Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Realtime vehicle position data is delivered through a vehicleMonitoringDeliveryStructure containing one or more VehicleActivity elements.

VehicleActivity

The vehicle position for one vehicle is contained in a VehicleActivity element. The following fields are supported by Samtrafiken. Any fields or attributes not on the list are ignored.

Field

Required

Notes

RecordedAtTime

Required

RecoredAtTimeValidUntilTime

Required

Ignored by Samtrafiken

MonitoredVehicleJourney > FramedVehicleJourneyRef > DatedVehicleJourneyRef

Required

Should match static data idLineRef

Required

Reference to Line in the static data, for example SE:022:Line:1234

MonitoredVehicleJourney > VehicleRef

Required

A unique id for the physical vehicle. If the static data contains this vehicle, then the id should match the static data. The value should be a positive number.

MonitoredVehicleJourney > FramedVehicleJourneyRef > VehicleRefDatedVehicleJourneyRef

RequiredAn id for this physical vehicle

Reference to ServiceJourney in the static data, for example SE:022:ServiceJourney:1234567-12345

MonitoredVehicleJourney > FramedVehicleJourneyRef > DataFrameRef

Required

Trip start date in YYYY-MM-DD format. Used to match with static data

MonitoredVehicleJourney > VehicleLocation > Latitude

Required

Northing coordinate, WGS84

MonitoredVehicleJourney > VehicleLocation > Longitude

Required

Easting coordinate, WGS84

MonitoredVehicleJourney > VehicleLocation[SrsName]

Optional

WGS84 when unspecified. WGS84 is recommended since this avoids possible loss of resolution during conversion.

Valid values:

  • WGS84

  • 4326

  • SWEREF99TM

  • RT90

MonitoredVehicleJourney > Bearing

Optional

Compass bearing in degrees (0-359.99), rounded down to the nearest integer by Samtrafiken.

MonitoredVehicleJourney > Velocity

Optional

Speed, in kilometers per hour, rounded down to the nearest integer by Samtrafiken..

MonitoredVehicleJourney > Occupancy

Optional

Realtime occupancy. One of

  • full

  • standingAvailable

  • seatsAvailable

Example

The following example shows what SIRI-VM data delivered to Samtrafiken can look like. Note that there are multiple fields which are not interpreted by Samtrafiken (see table above regarding which fields are required)

...

MonitoredVehicleJourney > Delay

Required

Ignored by Samtrafiken, Samtrafiken reads delays from SIRI-ET streams.

Required in order to adhere to the Nordic SIRI profile. Duration which can be negative if the vehicle is early. PT0S when there are no delays.

Example

Code Block
breakoutModewide
languagexml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vehicleMonitoringDeliveryStructure version="2.0" xmlns:ns5="http://www.siri.org.uk/siri" xmlns:ns2="http://www.ifopt.org.uk/acsb" xmlns:ns4="http://datex2.eu/schema/2_0RC1/2_0" xmlns:ns3="http://www.ifopt.org.uk/ifopt">
    <ns5:ResponseTimestamp>2024-10-21T18:10:15+02:00</ns5:ResponseTimestamp>
    <ns5:SubscriberRef>Samtrafiken</ns5:SubscriberRef> <!-- SubscriberRef, according to the publish/subscribe subscription when using publish/subscribe for data transfer -->
    <ns5:SubscriptionRef>vehicle_monitoring-1729534205</ns5:SubscriptionRef> <!-- subscription reference, only present when using publish/subscribe for data transfer -->
    <ns5:VehicleActivity> <!-- One VehicleMonitoringDeliveryStructure contains one or more VehicleActivities -->
        <ns5:RecordedAtTime>2024-10-21T18:09:56+02:00</ns5:RecordedAtTime> <!-- Position timestamp -->
        <ns5:ValidUntilTime>9999-12-31T23:59:59+01:00</ns5:ValidUntilTime>
        <ns5:ProgressBetweenStops>
            <ns5:LinkDistance>341</ns5:LinkDistance>
            <ns5:Percentage>34.90</ns5:Percentage>
 
      </ns5:ProgressBetweenStops>         <ns5:MonitoredVehicleJourney>
            <ns5:LineRef>SE:022:Line:9011000000001000</ns5:LineRef>
            <ns5:FramedVehicleJourneyRef>
                <ns5:DataFrameRef>2024-10-21T04:00:00</ns5:DataFrameRef>
                <ns5:DatedVehicleJourneyRef>SE:022:ServiceJourney:0000001-0000001</ns5:DatedVehicleJourneyRef>
            </ns5:FramedVehicleJourneyRef>
            <ns5:OperatorRef>25</ns5:OperatorRef>
            <ns5:OriginRef>SE:022:Quay:9022000000001000</ns5:OriginRef>
            <ns5:DestinationRef>SE:022:Quay:9022000000002000</ns5:DestinationRef>
            <ns5:Monitored>true</ns5:Monitored>
            <ns5:DataSource>DinTur</ns5:DataSource>
            <ns5:VehicleLocation>
                <ns5:Longitude>17.32767</ns5:Longitude>
                <ns5:Latitude>62.395068</ns5:Latitude>
            </ns5:VehicleLocation>
            <ns5:Bearing>129.0</ns5:Bearing>
            <ns5:Delay>-PT15S</ns5:Delay>
            <ns5:VehicleStatus>offRoute</ns5:VehicleStatus>
            <ns5:VehicleRef>3830101497</ns5:VehicleRef>
        </ns5:MonitoredVehicleJourney>
    </ns5:VehicleActivity>
    <ns5:VehicleActivity>
    ...
    </ns5:VehicleActivity>
</vehicleMonitoringDeliveryStructure>