Exemplo n.º 1
0
import pytz

MAX_DISTANCE = 801

if len(sys.argv) < 2:
    USAGE = """usage: timetable.py inputfile.gtfsdb [calendar start date] 
    If a start date is provided in YYYY-MM-DD format, a calendar will be built for the 32 days following the given date. 
    Otherwise the service calendar will be analyzed and the month with the maximum number of running services will be used."""
    print USAGE
    exit(1)

db = GTFSDatabase(sys.argv[1])

out = open("./timetable.dat", "wb")

feed_start_date, feed_end_date = db.date_range()
print 'feed covers %s -- %s' % (feed_start_date, feed_end_date)

# second command line parameter: start date for 32-day calendar
try:
    start_date = date(*map(int, sys.argv[2].split('-')))
except:
    print 'Scanning service calendar to find the month with maximum service.'
    print 'NOTE that this is not necessarily accurate and you can end up with sparse service in the chosen period.'
    start_date = db.find_max_service()
print 'calendar start date is %s' % start_date

timezones = db.agency_timezones()
if len(db.agency_timezones()) > 1:
    print 'Currently we only support one timezone being active, selected: ' + timezones[
        0]
Exemplo n.º 2
0
from gtfsdb import GTFSDatabase
import sys

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print "usage: python gtfsdb_stats.py gtfsdb_filename"
        exit()

    db = GTFSDatabase(sys.argv[1])
    print "extent: %s" % (db.extent(), )
    print "stop count: %d" % db.count_stops()

    print "date range: %s" % (db.date_range(), )
Exemplo n.º 3
0
import pytz

MAX_DISTANCE = 801

if len(sys.argv) < 2 :
    USAGE = """usage: timetable.py inputfile.gtfsdb [calendar start date] 
    If a start date is provided in YYYY-MM-DD format, a calendar will be built for the 32 days following the given date. 
    Otherwise the service calendar will be analyzed and the month with the maximum number of running services will be used."""
    print USAGE
    exit(1)

db = GTFSDatabase(sys.argv[1])    

out = open("./timetable.dat", "wb")

feed_start_date, feed_end_date = db.date_range()
print 'feed covers %s -- %s' % (feed_start_date, feed_end_date)

# second command line parameter: start date for 32-day calendar
try :
    start_date = date( *map(int, sys.argv[2].split('-')) )
except :
    print 'Scanning service calendar to find the month with maximum service.'
    print 'NOTE that this is not necessarily accurate and you can end up with sparse service in the chosen period.'
    start_date = db.find_max_service()
print 'calendar start date is %s' % start_date

timezones = db.agency_timezones()
if len(db.agency_timezones()) > 1:
    print 'Currently we only support one timezone being active, selected: '+timezones[0]
print 'using timezone '+timezones[0]
Exemplo n.º 4
0
from gtfsdb import GTFSDatabase
import sys

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print "usage: python gtfsdb_stats.py gtfsdb_filename"
        exit()

    db = GTFSDatabase(sys.argv[1])
    print "extent: %s" % (db.extent(),)
    print "stop count: %d" % db.count_stops()

    print "date range: %s" % (db.date_range(),)