How should trip/route matching work? Does Tagkompaniet run as SJ?
Hej! I am using "ResRobot - Stolptidtabeller 2" to get realtime information e.g. for ResRobot nation wide stop id 740000196 which seem to belong to agency Tagkompaniet, agency_id 315, and got this as (an extract of) the result.
'name': 'Regional Tåg 8023',
'origin': 'Ängelsberg station (Fagersta kn)',
'stop': 'Virsbo station (Surahammar kn)',
'stopExtId': '740000196',
'stopid': '740000196',
'time': '08:07:00',
'transportCategory': 'JRE',
'transportNumber': '8023'
However I can't match this route with the Static GTFS 'Sverige 2', instead I find there e.g. this entry in routes.txt of the Static GTFS zip:
2352,74,8023,,102,http://www.resrobot.se/
which seems to be the agency_id 74, so SJ, former state railway?
I wonder how the matching should work, can you give an example?
Hej da, thanks a lot!
You will find the transportNumber in trips.txt as the trip_short_name.
Example:
trips.txt
route_id,service_id,trip_id,trip_headsign,trip_short_name
10827,000018,127742,Västerås Centralstation,8023
routes.txt
route_id,agency_id,route_short_name,route_long_name,route_type,route_url
10827,315,,Tåg i Bergslagen,102,http://www.resrobot.se/
agency.txt
agency_id,agency_name,agency_url,agency_timezone,agency_lang
315,Tågkompaniet,http://www.resrobot.se/,Europe/Stockholm,sv
Thanks a lot, I was really blind and that was really really helpful.
Is it ok to use "ResRobot - Stolptidtabeller 2" for all agencies, even for SL Stockholm, or are there any benefits if I detect it is a SL stop/area/site to use "SL Realtime 3" instead? Do you know if there is a benefit to use the separate Västtraffik API for Gothenborg at https://developer.vasttrafik.se, or is it more or less included by using the APIs from here?
BTW, I met following assumptions, but I am not sure if they are really correct:
Only stop ids from stops.txt of GTFS.zip are valid to use for ResRobot API (for example, I retrieved ResRobot stop id=740016962 for agency id 173 and their specific stop id 2 by doing a mapping, but ResRobot will not accept this stop id, and it is also not contained in stops.txt). So, there is no way to get VALID ResRobot stop ids by API call?
Agency id mapping is also to be done by agency.txt of GTFS.zip. So, there is no way to get an agency id to name mapping by API call?
Hi MB
It depends on what you are trying to do if it is beneficial to use SL or Resrobot. With SL APIs its possible to get more information about stops and location of stops compared with resrobot.
You can use gtfs stops.txt in resrobots API, but you can also use https://www.trafiklab.se/api/resrobot-reseplane... this api to lookup a stop id.
No there is no way to get agency id name by api call.
Best regards
Daniel