[places] adding section called city_replacements to places config, for countries where something like the state_district/county, suburb or city_district should stand in for the city when one cannot be reverse geocoded (unincorporated county addresses, etc.)

This commit is contained in:
Al
2016-11-22 09:51:04 -05:00
parent 480796f46f
commit aa1f4fdd20
2 changed files with 29 additions and 1 deletions

View File

@@ -159,10 +159,14 @@ class PlaceConfig(object):
new_components = components.copy()
city_replacements = set()
if AddressFormatter.CITY not in components:
city_replacements = set(self.get_property(('city_replacements', ), country=country))
for component in admin_components:
include = self.include_component(component, containing_ids, country=country, population=population)
if not include:
if not include and component not in city_replacements:
# Note: this check is for cities that have the same name as their admin
# areas e.g. Luxembourg, Luxembourg. In cases like this, if we were to drop
# city, we don't want to include country on its own. This should help the parser