compute-regions.py

changeset 89
438d77bca50e
parent 88
3b86597c5a88
child 124
c3b022f51704
equal deleted inserted replaced
88:3b86597c5a88 89:438d77bca50e
6 from configparser import ConfigParser 6 from configparser import ConfigParser
7 from regions import parse_regions 7 from regions import parse_regions
8 8
9 representatives = {} 9 representatives = {}
10 10
11 regions = parse_regions(sys.argv[1]) 11 regions = parse_regions(sys.argv[2])
12 bus_stops = {} 12 bus_stops = {}
13 13
14 with ZipFile('gtfs.zip') as archive: 14 with ZipFile(sys.argv[1]) as archive:
15 with archive.open('stops.txt') as file: 15 with archive.open('stops.txt') as file:
16 for row in read_csv(map(bytes.decode, file)): 16 for row in read_csv(map(bytes.decode, file)):
17 location = Location(float(row['stop_lat']), float(row['stop_lon'])) 17 location = Location(float(row['stop_lat']), float(row['stop_lon']))
18 reference = row['stop_id'] 18 reference = row['stop_id']
19 bus_stops[reference] = location 19 bus_stops[reference] = location

mercurial