13 'paasniittu': 'ruskon keskusta', |
13 'paasniittu': 'ruskon keskusta', |
14 'kahari': 'ruskon keskusta', |
14 'kahari': 'ruskon keskusta', |
15 'kemiö': 'kemiönsaari', |
15 'kemiö': 'kemiönsaari', |
16 'kasnäs': 'kemiönsaari', |
16 'kasnäs': 'kemiönsaari', |
17 'pernon telakka': 'perno', |
17 'pernon telakka': 'perno', |
|
18 'paimion sairaala': 'paimio', |
|
19 'hanhijoki': 'paimio', |
18 } |
20 } |
19 |
21 |
20 # nimiä joista voidaan joustaa tarvittaessa |
22 # nimiä joista voidaan joustaa tarvittaessa |
21 abbreviations = { |
23 abbreviations = { |
22 'raision keskusta': 'raisio', |
24 'raision keskusta': 'raisio', |
174 # lajitellaan painoarvot uudestaan reittijärjestykseen jotta sign tulee oikeinpäin |
178 # lajitellaan painoarvot uudestaan reittijärjestykseen jotta sign tulee oikeinpäin |
175 weights = sorted(weights, key = lambda weight_data: weight_data[2]) |
179 weights = sorted(weights, key = lambda weight_data: weight_data[2]) |
176 # muodostetaan sign.. |
180 # muodostetaan sign.. |
177 sign = [paino[0] for paino in weights] |
181 sign = [paino[0] for paino in weights] |
178 to_place = sign[-1] |
182 to_place = sign[-1] |
|
183 nearby_municipalities = {'Turku', 'Raisio', 'Naantali', 'Kaarina', 'Lieto'} |
179 if from_place != to_place: |
184 if from_place != to_place: |
180 municipality_from = municipalities_per_region.get(from_place) |
185 municipality_from = municipalities_per_region.get(from_place) |
181 municipality_to = municipalities_per_region.get(to_place) |
186 municipality_to = municipalities_per_region.get(to_place) |
182 if municipality_from and municipality_to and municipality_from not in ['Turku', municipality_to]: |
187 if municipality_from and municipality_to and municipality_from not in nearby_municipalities | {municipality_to} and municipality_to not in nearby_municipalities: |
183 def convert_region(region): |
188 def convert_region(region): |
184 municipality = municipalities_per_region.get(region, region) |
189 municipality = municipalities_per_region.get(region, region) |
185 if municipality != municipality_from: |
190 if municipality != municipality_from: |
186 return municipality |
191 return municipality |
187 else: |
192 else: |