Routed Services Input Data format (XML)
In this section of the manual we discuss the routed services XML input format used by PLANit. Routed services require a Service Network to be defined on.
- If you are only interested to see an example file, jump to the Expanded Example.
- XML Schema of routed services https://www.goplanit.orgplanitmanual.github.io/version/
/xsd/routedservicesinput.xsd
<routedservices>
routed services can be described in a stand alone XML file - only describing the routed service characteristics - or as part of a PLANit XML file describing all input components. Either way, all routed services that exist on a given parent service network while its contents are defined within its XML root element <routedservices>
. When part of a larger (single) PLANit input file, the structure should resemble something like the following:
<PLANit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gml="http://www.opengis.net/gml"
xsi:noNamespaceSchemaLocation="https://planitmanual.github.io/version/<version>/xsd/routedservicesinput.xsd">
<routedservices>
...
</routedservices>
...
</PLANit>
Whereas if, it is a stand-alone file, it should look something like
<routedservices
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gml="http://www.opengis.net/gml"
xsi:noNamespaceSchemaLocation="https://planitmanual.github.io/version/<version>/xsd/routedservicesinput.xsd">
...
</routedservices>
This root element has an id as well as a service layers container element which references the related service network these routed services are defined upon:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
id |
YES | 1 | User identifier for the service network as a whole, i.e., its XML id |
externalid |
NO | 1 | Optional third party identifier for the routed services as a whole |
parentnetwork |
YES | 1 | Reference to the physical network’s id this service network is built on top of |
<servicelayers> |
YES | 1 | Service layer container element |
The service layers element contains the actual definitions of the routed services for each service network layer that is referenced.
In the remainder of this page, we discuss each of the routed services XML elements in order of expected appearance. We explore their attributes, sub-elements, or simple elements (elements without sub-elements). At the bottom of the page an expanded example is provided highlighting all the available options explicitly.
XML Elements
This section discusses the (complex) XML elements under the <routedservices>
root element in expected order of appearance.
<servicelayers>
This container element defines all the service layers that have routed services defined on them. the container is uniquely associated with a single service network, meaning that all its elements must reference a layer within that aprticualr service network.
This element has a single attribute:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
servicenetworkref |
string | None |
YES | Reference to a parent service network XML id |
The container element itself has one or more service layer elements for which routed services are defined:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<servicelayer> |
YES | unbounded | service layers for which rotued services are defined |
<> <servicelayer>
A service layer references a service layer in the parent service network while defining routed service on this referenced service layer.
All routed services that are defined supporting certain modes, must ensure that the supported modes are available on the reference service layer - which in turn rely on the physical layer it is based on - .
This element has the following attributes:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
id |
string | None |
YES | User identifier for the service layer as a whole, i.e., its XML id |
externalid |
string | None |
NO | Optional third party identifier |
servicelayerref |
string | None |
YES | Reference to parent service layer (XML) id |
Each service layer element has the following sub-element:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<services> |
YES | unbounded | Routed services container element |
<><> <services>
The actual routed services for a particular mode are defined within this container element.
The referenced mode must be available on the service layer.
This element has a single attribute:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
moderef |
string | None |
YES | Reference to the mode’s XML id the defined service pertain to |
Each Services element has one or more of the following sub-element:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<service> |
YES | unbounded | A routed service definition element |
<><><> <service>
A routed service definition is defined in this element. A routed service can either be frequency or schedule based.
This element has the following attributes:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
id |
string | None |
YES | User identifier for the routed service, i.e., its XML id |
externalid |
string | None |
NO | Optional third party identifier |
Each routed service has one or more of the following simple elements:
XML Simple Element Name | type | Unit | Compulsory | Default value | Description |
---|---|---|---|---|---|
<name> |
string | None |
NO | "” | The shortest possible description of the routed service, i.e. e.g. bus line number |
<namedescription> |
string | None |
NO | "” | More user friendly description of the routed service, i.e. e.g. bus line description displayed |
<servicedescription> |
string | None |
NO | "” | More elaborate description of service as a whole, not necessarily for users of the service |
<circular> |
boolean | None |
NO | FALSE |
Flag indicating if the service is circular or not |
Each Routed Service has trips defined through its sub-element:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<trips> |
YES | unbounded | The definition of the routed service trips |
<><><><> <trips>
The trips container element of a routed service instance.
This element has one of more of the following sub-elements:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<trip> |
YES | unbounded | A trip definition for a routed service |
<><><><><> <trip>
A trips defines either a scheduled or frequency based definition of a routed service trip. Note that this does not need to represent a single execution of the trip, a trip can define multiple executed trips through a schedule with multiple departures for this trip or via its frequency.
This element has the following attributes:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
id |
string | None |
YES | User identifier for the routed service trip definition, i.e., its XML id |
externalid |
string | None |
NO | Optional third party identifier |
Each trip definition has one of the two options below as sub-element:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<schedule> |
choice | 1 | Definition of a schedule based trip |
<frequency> |
choice | 1 | Definition of a frequency based trip |
<><><><><><> <schedule>
The schedule element describes a schedule for a routed service (trip). While possible to define a unique schedule for each trip with a single departure time and stop times, the schedule is deifned such that is allows to define multiple trips by defining multiple departure times and relative timings between stops via the reltimings element. As such a schedule has the following two sub-elements:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<departures> |
YES | 1 | Definition of a schedule’s departure times for this particular trip |
<reltimings> |
YES | 1 | Definition of a schedule’s relative stop times for this trip’s departures |
<><><><><><><> <departures>
The departures container element of scheduled routed service trip(s).
This element has one of more of the following sub-element:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<departure> |
YES | unbounded | A departure time trip definition for a scheduled routed service |
<><><><><><><><> <departure>
A specific departure time for a scheduled routed service trip. Each departure supports the following attributes:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
id |
string | None |
YES | User identifier for this particular departure, i.e., its XML id |
externalid |
string | None |
NO | Optional third party identifier |
time |
time | hh:mm:ss |
YES | The within-day departure time |
<><><><><><><> <reltimings>
The relative timings for each leg of each trip after it has departed by means of one of the specified departure times. Since these timings are applied to all defined departure times, they are in relative timing rather than absolute timing, hence the naming ‘reltimings’.
A default dwell time may be specified as an attribute. This is to be applied to all legs when no dwell time is available.
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
dwelltime |
time | hh:mm:ss |
NO | Default dwell time to apply, set to 00:00:00 when absent |
This element has one of more of the following sub-element:
XML Element Name | Compulsory | Maximum occurrences | Description |
---|---|---|---|
<leg> |
YES | unbounded | A leg of the scheduled trip relative to the departure time (or preceding leg) |
<><><><><><><><> <leg>
A leg of the scheduled routed trip, relative to the preceding leg (or departure time). Each leg has a duration and optional dwell time (at the end of the leg) to define its duration, as well as a references to the service network leg it is routed on.
A leg has the following attributes:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
lsref |
string | None |
YES | Reference to the direction service leg segment that defines the leg route |
duration |
time | hh:mm:ss |
YES | Duration of the leg as scheduled |
dwelltime |
time | hh:mm:ss |
NO | Dwell time to apply, when absent apply the reltimings dwelltime |
<><><><><><> <frequency>
A routed service can be defined based on frequency, in which case no individual scheduled services are defined by the average frequency (per hour) the routed service is being offered. This can be defined via this element
A frequency based routed service (trip) element defines a frequency as its value (floating point number) and has the following additional attributes:
XML attribute Name | type | Unit | Compulsory | Description |
---|---|---|---|---|
id |
string | None |
YES | User identifier for this particular frequency definition, i.e., its XML id |
externalid |
string | None |
NO | Optional third party identifier |
unit |
timeunit | None |
NO | Define the unit of the frequency, default is hour (h ) |
lsrefs |
string | None |
YES | Comma separated string of legsegments defining this routed service for this frequency |
An example of this element could look something like this:
<frequency lsrefs="34,21,44,2,8" unit="h">3.5</frequency>
Expanded Example
Below you will find an expanded example where all elements and attributes are explicitly set, to give you an idea of the overall structure of the routed services XML. This example does not make sense as an actual input file, it is purely meant to show off all aspects of the file, rather than be used as a practically feasible input file.
<routedservices
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gml="http://www.opengis.net/gml"
xsi:noNamespaceSchemaLocation="https://planitmanual.github.io/version/<version>/xsd/routedservicesinput.xsd">
<id>routed_services_id</id>
<servicelayers servicenetworkref="service_network">
<servicelayer id="routed_service_layer" servicelayerref="service_layer">
<services moderef="bus">
<service id="line_4">
<name>4</name>
<namedescription>city to beach</namedescription>
<servicedescription>bus line running from the city to the beach directly</servicedescription>
<trips>
<!-- in this example we have both frequency based trips and some additional explicitly scheduled trips -->
<trip id="scheduled_trips_line4" externalid="some_external_ref">
<schedule>
<departures>
<departure id="dep1" time="07:00:00" />
<departure id="dep2" time="09:50:00" />
</departures>
<reltimings dwelltime="00:30:00">
<leg lsref="ls1" duration="00:03:00" dwelltime="00:01:00" />
</reltimings>
</schedule>
</trip>
<trip id="frequency_based_trips_line_4" externalid="some_external_ref">
<frequency lsrefs="ls1" unit="h">3</frequency>
</trip>
</trips>
</service>
<!-- and another service in the opposite direction -->
<service id="line_4_opp">
<name>4</name>
<namedescription>beach to city</namedescription>
<servicedescription>bus line running from the beach to the city
directly</servicedescription>
<trips>
<!-- in this example we have only explicitly scheduled trips -->
<trip id="scheduled_trips_line4_opp" externalid="some_external_ref_opp">
<schedule>
<departures>
<departure id="1" time="08:00:00" />
<departure id="2" time="08:50:00" />
<departure id="3" time="09:30:00" />
</departures>
<reltimings>
<leg lsref="ls2" duration="00:03:00" dwelltime="00:02:00" />
</reltimings>
</schedule>
</trip>
</trips>
</service>
</services>
</servicelayer>
</servicelayers>
</routedservices>