[osm] Adding new option to control whether we drop non-city OSM boundary names that have the same name as the enclosed city

This commit is contained in:
Al
2016-07-25 01:24:13 -04:00
parent 1ccea09a92
commit 776145cf8e
2 changed files with 8 additions and 4 deletions

View File

@@ -628,6 +628,7 @@ class AddressComponents(object):
language_suffix='',
random_key=True,
always_use_full_names=False,
drop_duplicate_city_names=True,
):
'''
OSM boundaries
@@ -668,7 +669,7 @@ class AddressComponents(object):
for k in (key, name_key, raw_key, raw_name_key):
name = component_value.get(k)
if name and not (name == existing_city_name and component != AddressFormatter.CITY):
if name and not (name == existing_city_name and component != AddressFormatter.CITY and drop_duplicate_city_names):
break
# if we've checked all keys without finding a valid name, leave this component out
else: