mirror of
https://github.com/geohacker/bmtc.git
synced 2025-12-08 18:23:31 +00:00
18 lines
328 B
Python
18 lines
328 B
Python
import json
|
|
|
|
routes = json.load(open('data/routes.json', 'r'))
|
|
|
|
for route in routes['features']:
|
|
id = route['properties']['route']
|
|
# print len(id)
|
|
if (len(id) > 2):
|
|
route_id = id[:2]
|
|
else:
|
|
route_id = id[0]
|
|
|
|
route['properties']['id'] = route_id
|
|
# print route_id
|
|
|
|
|
|
print json.dumps(routes)
|