[boundaries] Adding option to still check for global overrides but only if nothing else was found using admin_level, etc. Updating South Korea and adding this option to Luxembourg.

This commit is contained in:
Al
2016-09-24 15:35:54 -04:00
parent 5a50082055
commit cd9fe4eb7b
3 changed files with 13 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
"6": "city_district"
"7": "suburb"
"8": "suburb"
no_global_overrides: true
global_overrides_last: true
overrides:
id:

View File

@@ -14,6 +14,8 @@
"407489":
admin_level:
"9": "city_district"
global_overrides_last: true
use_admin_center:
- id: 407489 # Luxembourg City

View File

@@ -139,8 +139,10 @@ class OSMAddressComponents(object):
values = [(k.lower(), v.lower()) for k, v in six.iteritems(properties) if isinstance(v, six.string_types)]
global_overrides_last = config.get('global_overrides_last', False)
# place=city, place=suburb, etc. override per-country boundaries
if not config.get('no_global_overrides', False):
if not global_overrides_last:
for k, v in values:
containing_component = self.global_keys_override.get(k, {}).get(v, None)
@@ -162,6 +164,13 @@ class OSMAddressComponents(object):
if containing_component is not None:
return containing_component
if global_overrides_last:
for k, v in values:
containing_component = self.global_keys_override.get(k, {}).get(v, None)
if containing_component is not None:
return containing_component
return None
osm_address_components = OSMAddressComponents()