gtfs v5 in progress trips and stop_times..
This commit is contained in:
parent
cce68a90c7
commit
c33cf4d15b
2
chaloBEST/gtfs/agency.txt
Normal file
2
chaloBEST/gtfs/agency.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
agency_id,agency_name,agency_url,agency_timezone
|
||||
1,BEST,www.chalobest.in,Asia/Kolkata
|
18
chaloBEST/gtfs/calendar.txt
Normal file
18
chaloBEST/gtfs/calendar.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
|
||||
MS,1,1,1,1,1,1,0,20000101,20500101
|
||||
HOL,0,0,0,0,0,0,1,20000101,20500101
|
||||
SUN,0,0,0,0,0,0,1,20000101,20500101
|
||||
MF&HOL,1,1,1,1,1,0,0,20000101,20500101
|
||||
SAT,0,0,0,0,0,1,0,20000101,20500101
|
||||
MF,1,1,1,1,1,0,0,20000101,20500101
|
||||
SH,0,0,0,0,0,0,1,20000101,20500101
|
||||
AD,1,1,1,1,1,1,1,20000101,20500101
|
||||
SAT&SUN,0,0,0,0,0,1,1,20000101,20500101
|
||||
MS&HOL,1,1,1,1,1,1,0,20000101,20500101
|
||||
FW,1,1,1,1,1,1,1,20000101,20500101
|
||||
SAT/SH,0,0,0,0,0,1,1,20000101,20500101
|
||||
SAT&HOL,0,0,0,0,0,1,0,20000101,20500101
|
||||
SAT&SH,0,0,0,0,0,1,1,20000101,20500101
|
||||
SAT/SUND&HOL,0,0,0,0,0,1,1,20000101,20500101
|
||||
S/H,0,0,0,0,0,0,1,20000101,20500101
|
||||
"SAT,SUN&HOL",0,0,0,0,0,1,1,20000101,20500101
|
9
chaloBEST/gtfs/frequencies.txt
Normal file
9
chaloBEST/gtfs/frequencies.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
trip_id,start_time,end_time,headway_secs
|
||||
282_1,07:00:00,11:00:00,360
|
||||
282_1,11:00:00,16:00:00,420
|
||||
282_1,16:00:00,22:00:00,480
|
||||
282_1,07:00:00,11:00:00,360
|
||||
289_1,07:00:00,11:00:00,600
|
||||
289_1,11:00:00,16:00:00,420
|
||||
289_1,16:00:00,22:00:00,420
|
||||
289_1,07:00:00,11:00:00,540
|
|
@ -32,7 +32,7 @@ def export_routes(routebeer):
|
|||
for route in routebeer:
|
||||
try:
|
||||
# data checks here
|
||||
filedude.writerow([route.id,route.alias,route.from_stop_txt + " - " + route.to_stop_txt,3])
|
||||
filedude.writerow([route.code,route.alias[0:3],route.from_stop_txt + " - " + route.to_stop_txt,3])
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -44,7 +44,7 @@ def export_stops(olist):
|
|||
# data checks here
|
||||
# stop_code is used for stop_id as its BEST specfic..
|
||||
#
|
||||
filedude.writerow([stop.code,stop.name,stop.point.coords[1],stop.point.coords[0]])
|
||||
filedude.writerow([stop.id,stop.name,stop.point.coords[1],stop.point.coords[0]])
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -52,18 +52,18 @@ def export_agency():
|
|||
filedude = csv.writer(open(join(PROJECT_ROOT, "gtfs/agency.txt"), "w"), delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
||||
|
||||
# also
|
||||
#filedude.writerow(["agency_id", "agency_name","agency_url","agency_timezone","agency_lang"])
|
||||
#filedude.writerow(["BEST","BrihanMumbai Electric Supply & Transport","http://www.bestundertaking.com/","Asia/Kolkata","en"])
|
||||
filedude.writerow(["agency_id", "agency_name","agency_url","agency_timezone","agency_lang"])
|
||||
filedude.writerow(["BEST","BrihanMumbai Electric Supply & Transport","http://www.bestundertaking.com/","Asia/Kolkata","en"])
|
||||
|
||||
filedude.writerow(["agency_id" ,"agency_name","agency_url","agency_timezone"])
|
||||
filedude.writerow([1 ,"BEST","www.chalobest.in","Asia/Kolkata"])
|
||||
#filedude.writerow(["agency_id" ,"agency_name","agency_url","agency_timezone"])
|
||||
#filedude.writerow([1 ,"BEST","www.chalobest.in","Asia/Kolkata"])
|
||||
|
||||
|
||||
# stop_code is used for stop_id as its BEST specfic..
|
||||
|
||||
SERVICE_SCHEDULE = [
|
||||
{'id':0,'code':'MS','days':[1,2,3,4,5,6]},
|
||||
{'id':1,'code':'HOL','days':[8]},
|
||||
{'id':1,'code':'HOL','days':[7,8]}, # should be only 8
|
||||
{'id':2,'code':'SUN','days':[7]},
|
||||
{'id':3,'code':'MF&HOL','days':[1,2,3,4,5,8]},
|
||||
{'id':4,'code':'SAT','days':[6]},
|
||||
|
@ -115,18 +115,18 @@ def export_calendar():
|
|||
def export_trips():
|
||||
filedude = csv.writer(open(join(PROJECT_ROOT, "gtfs/trips.txt"), "w"), delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
||||
filedude.writerow(["route_id","service_id","trip_id"])
|
||||
filedude.writerow(["246","MS","282_1"])
|
||||
filedude.writerow(["2820","MS","2820_1"])
|
||||
#filedude.writerow(["246","HOL","282_2"])
|
||||
#filedude.writerow(["246","SUN","282_3)"])
|
||||
|
||||
filedude.writerow(["253","MS","289_1"])
|
||||
filedude.writerow(["2894","MS","2894_1"])
|
||||
#filedude.writerow(["253","HOL","289_2"])
|
||||
#filedude.writerow(["253","SUN","289_3"])
|
||||
|
||||
# we need to get UniqueRoutes for each route, that is one trip, since it is based on service_id which shows days_of_run.
|
||||
# we need to be careful here because a filter queryset for UniqueRoutes can differ in order and a naming based on this order
|
||||
# will not be consistent. Its good to use a uniqueroute-serial number.
|
||||
|
||||
for r in routelist:
|
||||
"""
|
||||
try:
|
||||
# data checks here
|
||||
|
@ -149,17 +149,67 @@ def export_trips():
|
|||
|
||||
|
||||
|
||||
def export_stop_times():
|
||||
def export_stop_times(routelist):
|
||||
filedude = csv.writer(open(join(PROJECT_ROOT, "gtfs/stop_times.txt"), "w"), delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
||||
filedude.writerow(["trip_id","arrival_time","departure_time","stop_id","stop_sequence"])
|
||||
#routelist = getRoutesHavingAllLocs()
|
||||
routelist = RouteDetails.objects.filter(route_code='2820')
|
||||
routelist.append(RouteDetails.objects.get(route_code='2894'))
|
||||
filedude.writerow(["trip_id","arrival_time","departure_time","stop_id","stop_sequence"])
|
||||
#routelist = getRoutesHavingAllLocs()
|
||||
|
||||
#1. get routeDetails
|
||||
#2.
|
||||
for r in routelist:
|
||||
rds = RouteDetail.objects.filter(route=r).order_by('serial')
|
||||
|
||||
rds = RouteDetail.objects.filter(route=r).order_by('serial')
|
||||
for rd in rds:
|
||||
filedude.writerow()
|
||||
filedude.writerow([r.code+"_1","","",rd.stop.id,rd.serial])
|
||||
|
||||
|
||||
|
||||
"""
|
||||
stop_times.txt
|
||||
================================================================================================================================================
|
||||
1. For each route.
|
||||
2. Get rdlist = routedetails for that route.order_by('serial'). Get UniqueRoutes for the route.
|
||||
3. --- scenario -- Not considering uniqueroutes--
|
||||
|
||||
3.1 For rd in rdlist
|
||||
3.1.1 filewrite (trip_id,,,stopid,stop.serial)
|
||||
|
||||
----alternate scenario
|
||||
3. For each UniqueRoute, get from_to stops list (rdsubset) from RouteDetail list
|
||||
for unr in unrs:
|
||||
from_stop, to_stop
|
||||
rd_subset = rdlist[getserial(rdlist,from_stop):getserial(rdlist,to_stop)]
|
||||
"""
|
||||
|
||||
|
||||
def export_frequencies():
|
||||
filedude = csv.writer(open(join(PROJECT_ROOT, "gtfs/frequencies.txt"), "w"), delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
||||
"""
|
||||
EACH ROW IN FREQUENCIES
|
||||
- For an entry in atlas, [ i.e. a given trip+service_id [subset + schedule days] ]
|
||||
If there are headway timings for diff time slots, eg.
|
||||
h7-11, h11-16, h16-22,h22-25
|
||||
|
||||
then
|
||||
"""
|
||||
|
||||
filedude.writerow(["trip_id", "start_time","end_time","headway_secs"])
|
||||
filedude.writerow(["282_1","07:00:00","11:00:00",360])
|
||||
filedude.writerow(["282_1","11:00:00","16:00:00",420])
|
||||
filedude.writerow(["282_1","16:00:00","22:00:00",480])
|
||||
filedude.writerow(["282_1","07:00:00","11:00:00",360])
|
||||
filedude.writerow(["289_1","07:00:00","11:00:00",600])
|
||||
filedude.writerow(["289_1","11:00:00","16:00:00",420])
|
||||
filedude.writerow(["289_1","16:00:00","22:00:00",420])
|
||||
filedude.writerow(["289_1","07:00:00","11:00:00",540])
|
||||
|
||||
|
||||
def getserial(rdlist,stop):
|
||||
#check if rdlist is of a ring route..
|
||||
if rdlist[0].route.code[3]== 'R' or '4' :
|
||||
# write ring specific code here. rings have multiple occuring stops, which one to choose??
|
||||
pass
|
||||
|
||||
for rd in rdlist:
|
||||
if(rd.stop==stop):
|
||||
return rdlist.index(rd)
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
route_id,route_short_name,route_long_name,route_type
|
||||
246,282,KANDIVLI BUS STATION ( E ) - DAMU NAGAR EXTENSION,3
|
||||
253,289RING,KANDIVLI BUS STATION ( E ) - ANITA NAGAR,3
|
||||
2820,282,KANDIVLI BUS STATION ( E ) - DAMU NAGAR EXTENSION,3
|
||||
2894,289,KANDIVLI BUS STATION ( E ) - ANITA NAGAR,3
|
||||
|
|
33
chaloBEST/gtfs/stop_times.txt
Normal file
33
chaloBEST/gtfs/stop_times.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
trip_id,arrival_time,departure_time,stop_id,stop_sequence
|
||||
2820_1,,,1188,1
|
||||
2820_1,,,1189,2
|
||||
2820_1,,,1190,3
|
||||
2820_1,,,1191,4
|
||||
2820_1,,,1834,5
|
||||
2820_1,,,1192,6
|
||||
2820_1,,,1193,7
|
||||
2820_1,,,1214,8
|
||||
2820_1,,,1197,9
|
||||
2820_1,,,1199,10
|
||||
2820_1,,,1198,11
|
||||
2894_1,,,1188,1
|
||||
2894_1,,,1189,2
|
||||
2894_1,,,1190,3
|
||||
2894_1,,,1191,4
|
||||
2894_1,,,1834,5
|
||||
2894_1,,,1192,6
|
||||
2894_1,,,1193,7
|
||||
2894_1,,,1197,8
|
||||
2894_1,,,1822,9
|
||||
2894_1,,,1928,10
|
||||
2894_1,,,1929,11
|
||||
2894_1,,,1196,12
|
||||
2894_1,,,1195,13
|
||||
2894_1,,,1194,14
|
||||
2894_1,,,1193,15
|
||||
2894_1,,,1192,16
|
||||
2894_1,,,1834,17
|
||||
2894_1,,,1191,18
|
||||
2894_1,,,1190,19
|
||||
2894_1,,,1189,20
|
||||
2894_1,,,1188,21
|
|
@ -1,17 +1,17 @@
|
|||
stop_id,stop_name,stop_lat,stop_lon
|
||||
1540,E.S.I.S.HOSPITAL,19.20185,72.85639
|
||||
1541,GROVEL CO.,19.20158,72.8605
|
||||
1543,SAMBHAJI NGR.(KANDIVLI-E),19.20096,72.86366
|
||||
1544,HANUMAN NGR.,19.2013,72.86613
|
||||
1545,TRACTOR GATE NO 3/VASA HOSPITAL,19.20067,72.8716
|
||||
2850,NARSIPADA,19.20114,72.86483
|
||||
1547,ALIKA NGR.JN.,19.19757,72.87214
|
||||
1548,ANITA NGR.,19.19711,72.87505
|
||||
1550,GAUTAM NGR.,19.20013,72.87823
|
||||
1551,DAMU NGR.EXTN.,19.20453,72.87845
|
||||
1552,DAMU NGR./MAYUR MARKET,19.20106,72.87881
|
||||
3003,NEIGHBOUR HOOD SCTY.,19.2011,72.87891
|
||||
2835,RAMGAD (ANITA NGR.),19.19711,72.87505
|
||||
3004,GREEN HILL GATE NO.4,19.19506,72.87563
|
||||
1546,SAI GARDEN,19.1992,72.87307
|
||||
1583,OTIS CO.,19.20031,72.87692
|
||||
1189,E.S.I.S.HOSPITAL,19.20185,72.85639
|
||||
1190,GROVEL CO.,19.20158,72.8605
|
||||
1191,SAMBHAJI NGR.(KANDIVLI-E),19.20096,72.86366
|
||||
1192,HANUMAN NGR.,19.2013,72.86613
|
||||
1193,TRACTOR GATE NO 3/VASA HOSPITAL,19.20067,72.8716
|
||||
1834,NARSIPADA,19.20114,72.86483
|
||||
1195,ALIKA NGR.JN.,19.19757,72.87214
|
||||
1196,ANITA NGR.,19.19711,72.87505
|
||||
1197,GAUTAM NGR.,19.20013,72.87823
|
||||
1198,DAMU NGR.EXTN.,19.20453,72.87845
|
||||
1199,DAMU NGR./MAYUR MARKET,19.20106,72.87881
|
||||
1928,NEIGHBOUR HOOD SCTY.,19.2011,72.87891
|
||||
1822,RAMGAD (ANITA NGR.),19.19711,72.87505
|
||||
1929,GREEN HILL GATE NO.4,19.19506,72.87563
|
||||
1194,SAI GARDEN,19.1992,72.87307
|
||||
1214,OTIS CO.,19.20031,72.87692
|
||||
|
|
3
chaloBEST/gtfs/trips.txt
Normal file
3
chaloBEST/gtfs/trips.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
route_id,service_id,trip_id
|
||||
2820,MS,282_1
|
||||
2894,MS,289_1
|
Loading…
Reference in New Issue
Block a user