compute-regions.py

changeset 52
cab8d38fe5c6
parent 32
ca1a0ea81cf6
child 73
c56b0ef96514
equal deleted inserted replaced
51:145b453ba8f2 52:cab8d38fe5c6
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 import sys, json 2 import sys, json
3 from misc import * 3 from misc import *
4 from geometry import * 4 from geometry import *
5 from zipfile import ZipFile 5 from zipfile import ZipFile
6 from configparser import ConfigParser
7
8 representatives = {}
9
10 region_data = ConfigParser()
11 region_data.read('regions.ini')
12
13 for section in region_data.sections():
14 for key, value in region_data[section].items():
15 representatives[key] = value
6 16
7 with open('regions.gmp') as file: 17 with open('regions.gmp') as file:
8 data = file.read().split('@') 18 data = file.read().split('@')
9
10 with open('region-representatives.json') as file:
11 representatives = json.load(file)
12 19
13 bus_stops = {} 20 bus_stops = {}
14 21
15 with ZipFile('gtfs.zip') as archive: 22 with ZipFile('gtfs.zip') as archive:
16 with archive.open('stops.txt') as file: 23 with archive.open('stops.txt') as file:

mercurial