diff --git a/mapsme_subways.py b/mapsme_subways.py index 800c5c1..4ddad90 100755 --- a/mapsme_subways.py +++ b/mapsme_subways.py @@ -316,7 +316,10 @@ if __name__ == '__main__': json.dump(get_unused_entrances_geojson(osm), options.entrances) if options.dump: - dump_data(cities[0], options.dump) + if len(cities) == 1: + dump_data(cities[0], options.dump) + else: + logging.error('Cannot dump %s cities at once', len(cities)) # Finally, prepare a JSON file for MAPS.ME if options.output: diff --git a/v2h_templates.py b/v2h_templates.py index a90f4ad..a9daca4 100644 --- a/v2h_templates.py +++ b/v2h_templates.py @@ -42,6 +42,7 @@ INDEX_HEADER = '''

Subway Validation Results

+

Total good metro networks: {good_cities} of {total_cities}.

'''.replace('(s)', STYLE) diff --git a/validation_to_html.py b/validation_to_html.py index 2b3d656..8b1d19b 100755 --- a/validation_to_html.py +++ b/validation_to_html.py @@ -40,7 +40,7 @@ class CityData: def __add__(self, other): d = CityData() - for k in self.data: + for k in set(self.data.keys()) | set(other.data.keys()): d.data[k] = self.data.get(k, 0) + other.data.get(k, 0) return d @@ -109,11 +109,12 @@ for c in data.values(): if c.continent not in c_by_c: c_by_c[c.continent] = set() c_by_c[c.continent].add(c.country) +world = sum(continents.values(), CityData()) date = datetime.datetime.now().strftime('%d.%m.%Y %H:%M') path = '.' if len(sys.argv) < 3 else sys.argv[2] index = open(os.path.join(path, 'index.html'), 'w', encoding='utf-8') -index.write(tmpl(INDEX_HEADER)) +index.write(tmpl(INDEX_HEADER, world)) for continent in sorted(continents.keys()): content = ''