Samtrafiken Noptis to GTFS mapping
This page describes how Samtrafiken maps Noptis data (see https://www.noptis.com/ ) to static GTFS data. For a complete specification of the GTFS format, please see http://gtfs.org/reference/static.
Data older than 3 days in the past is not imported. This means that, even if input data contains years of data in the past, only data with a validity period ending later than 3 days in the past can be imported and exported
Feed Info
feed_info.txt
is not derived from any Noptis data. It is created based on the data-source configuration by Samtrafiken.
Field | Source data |
---|---|
feed_id | |
feed_publisher_name |
|
feed_publisher_url |
|
feed_lang |
|
feed_version | Current day in yyyy-mm-dd format |
Agency
Agencies are based on Noptis TransportAuthority objects. Some additional details, configured by Samtrafiken, are exported for the “primary” TransportAuthority in the region which is being exported.
Field | Source data |
---|---|
agency_id | TransportAuthority.id |
agency_name | TransportAuthority.FormalName if set, |
agency_url | Agency homepage, configured by Samtrafiken |
agency_timezone |
|
agency_lang |
|
agency_fare_url | Agency homepage, configured by Samtrafiken |
Routes
Each route is based on a Noptis Line. Since there are cases where some journeys skip certain stops on the line (for example, a bus 1 and a bus 1X which share a Line), these Lines are split into one route per headsign.
If a Line only has journeys with the same headsign, there will be one Route that corresponds with the template.
If a Line has journeys with a different headsign, there will be one Route for each headsign that corresponds with the template.
Field | Source data |
---|---|
route_id | Line.Gid when this the main route of a Noptis Line. The main route is the route with the shortest LineDesignation. Line.Gid-DestinationDisplay.LineDesignation when this is an additional route on a Noptis Line. For example, a line with Gid 1 and lineDesignations 8 and 8X will result in two routes with the following ids:
|
agency_id | TransportAuthority.Id |
route_short_name | DestinationDisplay.LineDesignation |
route_long_name | Line.Name (only if Line.Name is set and different from DestinationDisplay.LineDesignation, otherwise empty) |
route_type | Line.DefaultTransportModeCode
|
route_desc | GroupOfLines.Name |
Trips
Trips are based on VehicleJourneys. For each unique DirectionOfLine Gid, the most recent DirectionOfLine is kept. For these kept DirectionOfLines VehicleJourneys are fetched. This means that, if there are past or future versions of a certain DirectionOfLine, trips associated to these versions will not be exported.
Each exported VehicleJourney is represented by one line in trips.txt
.
Field | Source data |
---|---|
route_id | Line.Gid when this the main route of a Noptis Line. The main route is the route with the shortest LineDesignation. Line.Gid-DestinationDisplay.LineDesignation When this is an additional route on a Noptis Line. |
service_id | sequential integer id, starting at |
trip_id | VehicleJourney.Id |
trip_headsign | Empty since this information is already present in route_short_name and route_long_name |
direction_id | DirectionOfLine.DirectionCode
|
shape_id | sequential integer id, starting at |
Calendar
Calendar.txt
is only used to indicate the validity period for trips. All days are hardcoded to 0
(no traffic), after which actual traffic is added through calendar_dates.txt
.
The calendar is constructed by going through all VehicleJourneys (which become GTFS Trips), and looking up all DatedVehicleJourneys for each of those VehicleJourneys. The collection of dates in the DatedVehicleJourneys for one VehicleJourney becomes a GTFS calendar entry, identified by a service_id in the GTFS Calendar and Calendar_dates file.
Each combination of dates for VehicleJourneys will have one service_id at most. If there are multiple VehicleJourneys with the same dates, both VehicleJourneys (GTFS Trips) will share the same service_id and calendar.
Field | Source data |
---|---|
service_id | Sequential integer id, starting at |
monday |
|
tuesday |
|
wednesday |
|
thursday |
|
friday |
|
saturday |
|
sunday |
|
start_date | First |
end_date | Last |
Calendar_dates
Calendar_dates.txt
is used to indicate on which days a trip is run. It is constructed by going through all VehicleJourneys (which become GTFS Trips), and looking up all DatedVehicleJourneys for each of those VehicleJourneys. The collection of dates in the DatedVehicleJourneys for one VehicleJourney becomes a GTFS calendar entry, identified by a service_id in the GTFS Calendar and Calendar_dates file. Each DatedVehicleJourney becomes a row in calendar_dates, linking a GTFS trip to the date specified in the calendar_date.
Each combination of dates for VehicleJourneys will have one service_id at most. If there are multiple VehicleJournes with the same dates, both VehicleJourneys (GTFS Trips) will share the same service_id and calendar_dates rows.
Field | Source data |
---|---|
service_id | Sequential integer id, starting at |
date |
|
exception_type |
|
Stop_times
For each GTFS Trip, which is based on a VehicleJourney, its stops are obtained from the associated CallAndPointInJourneyPatterns through the TimedJourneyPattern and VehicleJourneyTemplate. Each call becomes one row in stop_times.txt
. Only stops which are associated with a StopPoint are exported.
DestinationDisplay is used to fill in the stop_headsign field. This is done by obtaining the NamedJourneyPattern for the VehicleJourneyTemplate, followed by looking up if a DestinationDisplay matches the DestinationPatternId and PointInJourneyPatternId.
Field | Source data |
---|---|
trip_id | VehicleJourney.Id |
arrival_time | VehicleJourney.PlannedStartOffsetDayTime + CallOnTimedJourneyPattern.LatestArrivalTimeOffsetSeconds |
departure_time | VehicleJourney.PlannedStartOffsetDayTime + CallOnTimedJourneyPattern.EarliestDepartureTimeOffsetSeconds |
stop_id | StopPoint.Gid (through CallOnTimedJourneyPattern → PointInJourneyPattern) |
stop_sequence | PointInJourneyPattern.SequenceNumber |
stop_headsign | Depends on DestinationDisplay:
|
pickup_type | PointInJourneyPattern.DepartureType:
|
drop_off_type | PointInJourneyPattern.ArrivalType:
|
shape_dist_traveled | Sum of distances in RouteLink.DistanceMeters up to this point |
timepoint | CallOnTimedJourneyPattern.isTimingPoint |
Stops
The content in the stops.txt
file is generated from multiple sources: StopAreas, StopPoints and StationEntryPoints.
StopAreas in Stops.txt
Field | Source data |
---|---|
stop_id | StopArea.Gid |
stop_name | StopArea.Name |
stop_lat | StopArea.CentroidNorthingCoordinate |
stop_lon | StopArea.CentroidEastingCoordinate |
location_type | 1 |
parent_station | empty |
platform_code | empty |
StopPoints in Stops.txt
Field | Source data |
---|---|
stop_id | StopPoint.Gid |
stop_name | StopPoint.Name if available, otherwise StopArea.Name |
stop_lat | JourneyPatternPoint.CentroidNorthingCoordinate |
stop_lon | JourneyPatternPoint.CentroidEastingCoordinate |
location_type | 0 |
parent_station | StopPoint.IsIncludedInStopAreaGid |
platform_code | StopPoint.Designation |
StationEntrancePoints in Stops.txt
Field | Source data |
---|---|
stop_id | StationEntrancePoint.Gid |
stop_name | StationEntrancePoint.Name |
stop_lat | StationEntrancePoint.CentroidNorthingCoordinate |
stop_lon | StationEntrancePoint.CentroidEastingCoordinate |
location_type | 2 |
parent_station | StationEntrancePoint.IsIncludedInStopAreaGid |
platform_code | empty |
Shapes
Shapes.txt
contains the RouteLinks for the VehicleJourneys described in trips.txt
. The RouteLinks are selected by the TransportModeCode and JourneyPatternPoints.
Field | Source data |
---|---|
shape_id | sequential integer id, starting at |
shape_pt_lat | PointOnRouteLink.LocationEastingCoordinate |
shape_pt_lon | PointOnRouteLink.LocationNorthingCoordinate |
shape_pt_sequence | sequential integer id, starting at |
shape_dist_traveled | Sum of distances in RouteLink.DistanceMeters up to this point |
Transfers
Transfers.txt
contains 3 types of transfers:
stop-to-stop transfers from a StopArea to that same StopArea, based on StopArea.DefaultInterchangeDurationSeconds. Only created when DefaultInterchangeDurationSeconds is set.
stop-to-stop transfers between two StopPoints, based on ConnectionLinks.
trip-to-trip transfers, based on ConnectionCandidates with ConnectionType “ANSL”. The related JourneyPatternPoint GIDs are fetched by looking up the JourneyPatternPoint associated with the CallOnTimedJourneyPatterns that correspond with ConnectionCandidateEntity.IsFromFeederCallOnTimedJourneyPatternId / ConnectionCandidateEntity.IsToFetcherCallOnTimedJourneyPatternId
Field | Source data |
---|---|
from_stop_id | One of:
|
to_stop_id | One of:
|
from_trip_id | ConnectionCandidateEntity.IsFromFeederCallOnTimedJourneyPatternId |
to_trip_id | ConnectionCandidateEntity.IsToFetcherCallOnTimedJourneyPatternId |
transfer_type |
|
min_transfer_time | Only used for stop-to-stop transfers. One of (see description above):
|
Attribution
File attributions.txt
contains the operator name for each trip.
Field | Source data |
---|---|
trip_id | VehicleJourney.Id |
organization_name | Contractor.FormalName or Contractor.Name |
is_operator |
|
Extra: trips_dated_vehicle_journey.txt
We produce an additional file for those who want to map the GTFS data to the source Noptis data. trips_dated_vehicle_journey.txt
contains a mapping of trip_id
and operating_day_date
combination to find the original DatedVehicleJourney.Gid and the associated journey number.
Field | Source data |
---|---|
trip_id | GTFS |
operating_day_date | GTFS |
dated_vehicle_journey_gid | Noptis DatedVehicleJourney.Gid |
journey_number | DatedVehicleJourney journey number |