bmtc/scripts/clean_names.py
2016-02-05 17:35:11 +05:30

18 lines
388 B
Python

import json
# Get clean readable names for bus stops.
i = json.load(open('data/busstops.2015.geojson', 'r'))
o = open('data/busstops.2015.clean.json', 'w')
stops = {
'type': 'FeatureCollection',
'features': []
}
for stop in i['features']:
stop['properties']['name'] = stop['properties']['name'].split(',')[0]
stops['features'].append(stop)
o.write(json.dumps(stops))