From 7e007a49abeedbf1e0b43f38c81d0eecab872eae Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 18 Oct 2016 19:02:36 -0400 Subject: [PATCH] [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 --- resources/boundaries/osm/cn.yaml | 2 ++ resources/boundaries/osm/hu.yaml | 6 ++++++ resources/boundaries/osm/my.yaml | 3 +++ resources/boundaries/osm/no.yaml | 12 +++++++----- resources/boundaries/osm/th.yaml | 3 +++ scripts/geodata/osm/components.py | 5 ++--- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/resources/boundaries/osm/cn.yaml b/resources/boundaries/osm/cn.yaml index 557935bd..89d7b8ce 100644 --- a/resources/boundaries/osm/cn.yaml +++ b/resources/boundaries/osm/cn.yaml @@ -8,6 +8,8 @@ "8": "city" "10": "city" + place: + "district": "state_district" overrides: id: diff --git a/resources/boundaries/osm/hu.yaml b/resources/boundaries/osm/hu.yaml index 99114984..5bde9221 100644 --- a/resources/boundaries/osm/hu.yaml +++ b/resources/boundaries/osm/hu.yaml @@ -9,3 +9,9 @@ "9": "city_district" "10": "suburb" + overrides: + contained_by: + relation: + "1244004": + place: + "district": "city_district" \ No newline at end of file diff --git a/resources/boundaries/osm/my.yaml b/resources/boundaries/osm/my.yaml index 32b890ef..6b236e36 100644 --- a/resources/boundaries/osm/my.yaml +++ b/resources/boundaries/osm/my.yaml @@ -8,6 +8,9 @@ "8": "state_district" "10": "city" + place: + "district": "state_district" + overrides: id: # Kuala Lumpur diff --git a/resources/boundaries/osm/no.yaml b/resources/boundaries/osm/no.yaml index a957046f..dabe4bf8 100644 --- a/resources/boundaries/osm/no.yaml +++ b/resources/boundaries/osm/no.yaml @@ -1,7 +1,9 @@ --- - admin_level: - "2": "country" - "4": "state" - "7": "city" - "9": "city_district" + admin_level: + "2": "country" + "4": "state" + "7": "city" + "9": "city_district" + place: + "district": "city_district" \ No newline at end of file diff --git a/resources/boundaries/osm/th.yaml b/resources/boundaries/osm/th.yaml index ececca96..9f78b8eb 100644 --- a/resources/boundaries/osm/th.yaml +++ b/resources/boundaries/osm/th.yaml @@ -6,6 +6,9 @@ "8": "city_district" "10": "city" + place: + "district": "state_district" + overrides: id: relation: diff --git a/scripts/geodata/osm/components.py b/scripts/geodata/osm/components.py index 8750f37b..2973bb43 100644 --- a/scripts/geodata/osm/components.py +++ b/scripts/geodata/osm/components.py @@ -54,7 +54,6 @@ class OSMAddressComponents(object): 'state': AddressFormatter.STATE, 'region': AddressFormatter.STATE, 'province': AddressFormatter.STATE, - 'district': AddressFormatter.STATE_DISTRICT, 'county': AddressFormatter.STATE_DISTRICT, }, 'gnis:class': { @@ -112,7 +111,7 @@ class OSMAddressComponents(object): 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, {}) config = country_config @@ -157,7 +156,7 @@ class OSMAddressComponents(object): return containing_component # 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: containing_component = self.global_keys.get(k, {}).get(v, None)