regions.py

changeset 4
ac067a42b00f
parent 2
7378b802ddf8
--- a/regions.py	Thu Nov 05 14:52:50 2020 +0200
+++ b/regions.py	Fri Feb 05 12:16:29 2021 +0200
@@ -53,7 +53,14 @@
 	regions = dict()
 	extra_shapes = list()
 	for way in parse_boundaries(root, nodes = nodes):
-		if 'boundary' in way and 'ref' in way:
+		if 'boundary' in way and 'municipality' in way and 'name:fi' in way:
+			def clean(x):
+				return x.replace('/', '').replace(';', '')
+			way['ref'] = str.format(
+				'{municipality}/{name}',
+				municipality = str.upper(clean(way['municipality'])),
+				name = clean(way['name:fi']),
+			)
 			# defines a region
 			way['via_factor'] = int(way.get('via_factor', 1))
 			if way['ref'] in regions:

mercurial