[osm] removing place=district mapping globally (means city_district in Hungary) and mapping it specifically to state_district/city_district in the places where it's needed

This commit is contained in:
Al
2016-10-18 19:02:36 -04:00
parent 9384d8cc7e
commit 7e007a49ab
6 changed files with 23 additions and 8 deletions

View File

@@ -8,6 +8,8 @@
"8": "city" "8": "city"
"10": "city" "10": "city"
place:
"district": "state_district"
overrides: overrides:
id: id:

View File

@@ -9,3 +9,9 @@
"9": "city_district" "9": "city_district"
"10": "suburb" "10": "suburb"
overrides:
contained_by:
relation:
"1244004":
place:
"district": "city_district"

View File

@@ -8,6 +8,9 @@
"8": "state_district" "8": "state_district"
"10": "city" "10": "city"
place:
"district": "state_district"
overrides: overrides:
id: id:
# Kuala Lumpur # Kuala Lumpur

View File

@@ -1,7 +1,9 @@
--- ---
admin_level: admin_level:
"2": "country" "2": "country"
"4": "state" "4": "state"
"7": "city" "7": "city"
"9": "city_district" "9": "city_district"
place:
"district": "city_district"

View File

@@ -6,6 +6,9 @@
"8": "city_district" "8": "city_district"
"10": "city" "10": "city"
place:
"district": "state_district"
overrides: overrides:
id: id:
relation: relation:

View File

@@ -54,7 +54,6 @@ class OSMAddressComponents(object):
'state': AddressFormatter.STATE, 'state': AddressFormatter.STATE,
'region': AddressFormatter.STATE, 'region': AddressFormatter.STATE,
'province': AddressFormatter.STATE, 'province': AddressFormatter.STATE,
'district': AddressFormatter.STATE_DISTRICT,
'county': AddressFormatter.STATE_DISTRICT, 'county': AddressFormatter.STATE_DISTRICT,
}, },
'gnis:class': { 'gnis:class': {
@@ -112,7 +111,7 @@ class OSMAddressComponents(object):
return self.global_keys.get(prop, {}).get(value, None) return self.global_keys.get(prop, {}).get(value, None)
def component_from_properties(self, country, properties, containing=()): def component_from_properties(self, country, properties, containing=(), global_keys=True):
country_config = self.config.get(country, {}) country_config = self.config.get(country, {})
config = country_config config = country_config
@@ -157,7 +156,7 @@ class OSMAddressComponents(object):
return containing_component return containing_component
# other place keys like place=state, etc. serve as a backup # other place keys like place=state, etc. serve as a backup
# when no boundaries are available # when no admin_level tags are available
for k, v in values: for k, v in values:
containing_component = self.global_keys.get(k, {}).get(v, None) containing_component = self.global_keys.get(k, {}).get(v, None)