Fix build_city for cities with spaces, and yaml dump stations
This commit is contained in:
parent
7a05743a4d
commit
f022ada2c3
2 changed files with 5 additions and 4 deletions
|
@ -9,6 +9,7 @@ import time
|
|||
import urllib.parse
|
||||
import urllib.request
|
||||
from processors import processor
|
||||
from collections import OrderedDict
|
||||
|
||||
from subway_structure import (
|
||||
download_cities,
|
||||
|
@ -168,15 +169,15 @@ def dump_data(city, f):
|
|||
stops = set()
|
||||
routes = []
|
||||
for route in city:
|
||||
stations = ['{} ({})'.format(sa.name, sa.transfer or sa.id) for sa in route.stop_areas()]
|
||||
stations = OrderedDict([(sa.transfer or sa.id, sa.name) for sa in route.stop_areas()])
|
||||
rte = {
|
||||
'type': route.mode,
|
||||
'ref': route.ref,
|
||||
'name': route.name,
|
||||
'colour': route.colour,
|
||||
'infill': route.infill,
|
||||
'station_count': len(set(stations)),
|
||||
'stations': stations,
|
||||
'station_count': len(stations),
|
||||
'stations': list(stations.values()),
|
||||
'itineraries': {}
|
||||
}
|
||||
for variant in route:
|
||||
|
|
|
@ -11,6 +11,6 @@ fi
|
|||
if [ -n "${3-}" ]; then
|
||||
export BBOX="$3"
|
||||
elif [ -n "${CITY-}" ]; then
|
||||
export BBOX="$(python3 -c 'import subway_structure; c = [x for x in subway_structure.download_cities() if x.name == "'$CITY'"]; print("{1},{0},{3},{2}".format(*c[0].bbox))')" || true
|
||||
export BBOX="$(python3 -c 'import subway_structure; c = [x for x in subway_structure.download_cities() if x.name == "'"$CITY"'"]; print("{1},{0},{3},{2}".format(*c[0].bbox))')" || true
|
||||
fi
|
||||
"$(dirname "$0")/process_subways.sh" "$1"
|
||||
|
|
Loading…
Add table
Reference in a new issue