Coryza
Coryza

Reputation: 251

How to define irregular service in GTFS

Does anyone know how I should define a transit service that only occurs on public holidays, in GTFS?

calendar.txt as;
'4,0,0,0,0,0,0,0,20161211,20171209'

calendar_dates.txt as;
'4,20171001,1'
'4,20171002,1'
'4,20171225,1'
'4,20171226,1'

This apparently does not seem to work... My dataset also contains normal regular services, and they work fine.

Upvotes: 0

Views: 249

Answers (2)

Tony Laidig
Tony Laidig

Reputation: 1068

You need to both add new service and cancel the service

In this case, New Year’s Day is added as a Sunday schedule (exception_type 1), with the existing weekday schedule cancelled out (exception_type 2). In calendar.txt:

service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
weekday,1,1,1,1,1,0,0,20140101,20240101
saturday,0,0,0,0,0,1,0,20140101,20240101
sunday,0,0,0,0,0,0,1,20140101,20240101

In calendar_dates.txt:

service_id,date,exception_type
weekday,20140101,2
Sunday,20140101,1

See my blog post : http://transitdata.net/on-calendars-and-calendar_dates/ for more info

Upvotes: 0

paulh
paulh

Reputation: 314

Populate calendar_dates.txt exactly as you have shown above and put nothing in calendar.txt for service id 4

This is permitted by the spec, see

https://developers.google.com/transit/gtfs/reference/#calendar_datestxt

and I suspect that inserting an entry into calendar.txt with none of the days set to 1 is confusing validators.

Upvotes: 0

Related Questions