mirror of
https://github.com/apache/superset.git
synced 2026-05-29 20:29:34 +00:00
Implements the third transform: pull features from sibling Admin 0
records into a destination country's Admin 1 view. Used for:
- China + Taiwan/HK/Macau (NE keeps each as separate Admin 0)
- Finland + Åland (missing from FIN admin 1; NE keeps Åland as ALD
admin 0)
Verified on real data:
Building worldview=ukr admin_level=1
territory_assignments: added 4 features from sibling Admin 0 records
(4 = TWN/HKG/MAC + ALD; ARMM-renamed BARMM region picks up correctly
because name_overrides ran first.)
Two bugs fixed along the way:
1. **Property name casing.** NE Admin 0 ships with uppercase property
names (ADM0_A3, NAME_EN), Admin 1 with lowercase. All transforms
downstream assume lowercase, so we now normalize to lowercase at
shapefile-conversion time. Bonus: fixes a silent flying_islands
bug where `adm0_a3` filters never matched at Admin 0 because the
props were uppercase.
2. **drop_outside_bbox at Admin 0.** A country's multi-polygon often
includes overseas territories (Netherlands → Caribbean), so bbox
filtering at Admin 0 would drop entire countries. Now guarded to
only run at Admin 1 where each feature is a single subdivision.
3. **Åland's NE code.** NE uses ALD, not the ISO 3166-1 ALA. Updated
territory_assignments.yaml with comment noting the divergence.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
82 lines
2.9 KiB
YAML
82 lines
2.9 KiB
YAML
# Pull features from sibling Admin 0 records and add them to a country's
|
|
# Admin 1 view, optionally with a renamed iso_3166_2 code and translated
|
|
# names.
|
|
#
|
|
# Use when NE classifies a territory as a separate Admin 0 record but,
|
|
# for the purposes of a particular country's Admin 1 chart, it should
|
|
# appear inside that country. Common cases:
|
|
# - China + Taiwan/HK/Macau (NE has each as separate Admin 0)
|
|
# - Finland + Åland (NE has Åland separate; missing from FIN admin 1)
|
|
#
|
|
# This is NOT a tool for "moving" disputed territories between countries
|
|
# — for that, use NE worldview selection (e.g., the _ukr worldview moves
|
|
# Crimea from RUS to UKR for free, no config needed).
|
|
#
|
|
# Schema:
|
|
# countries:
|
|
# <ISO3 destination country>:
|
|
# additions:
|
|
# - description: human-readable why
|
|
# from:
|
|
# adm0_a3: <ISO3 source country>
|
|
# match:
|
|
# name_en: <feature name> # or other matchers
|
|
# set:
|
|
# iso_3166_2: <new code> # set when added
|
|
# name: <override display name> # optional
|
|
# name_<lang>: <translation> # optional, per language
|
|
# [...]
|
|
#
|
|
# Match semantics: same as other configs.
|
|
|
|
countries:
|
|
|
|
# -------------------------------------------------------------------
|
|
# China — add Special Administrative Regions
|
|
# NE keeps Taiwan (TWN), Hong Kong (HKG), and Macau (MAC) as separate
|
|
# Admin 0 records. For the China subdivision view we re-attach them
|
|
# using the official ISO 3166-2 codes (CN-71/91/92), with Chinese
|
|
# names from the official translations.
|
|
# -------------------------------------------------------------------
|
|
CHN:
|
|
additions:
|
|
- description: Add Taiwan as China subdivision CN-71
|
|
from:
|
|
adm0_a3: TWN
|
|
match: { name_en: Taiwan }
|
|
set:
|
|
iso_3166_2: CN-71
|
|
name_zh: 中国台湾
|
|
|
|
- description: Add Hong Kong SAR as CN-91
|
|
from:
|
|
adm0_a3: HKG
|
|
match: { name_en: Hong Kong }
|
|
set:
|
|
iso_3166_2: CN-91
|
|
name_zh: 香港特别行政区
|
|
|
|
- description: Add Macau SAR as CN-92
|
|
from:
|
|
adm0_a3: MAC
|
|
match: { name_en: Macau }
|
|
set:
|
|
iso_3166_2: CN-92
|
|
name_zh: 澳门特别行政区
|
|
|
|
# -------------------------------------------------------------------
|
|
# Finland — add Åland
|
|
# NE has Åland as a separate Admin 0 record (note: NE uses ALD, not
|
|
# the ISO 3166-1 ALA) and it is missing from the FIN admin1 dataset.
|
|
# Re-attach it as FI-01 with the Finnish name "Ahvenanmaan maakunta".
|
|
# -------------------------------------------------------------------
|
|
FIN:
|
|
additions:
|
|
- description: Add Åland as Finland subdivision FI-01
|
|
from:
|
|
adm0_a3: ALD # NE-specific code; ISO equivalent is ALA
|
|
match: { name_en: Åland }
|
|
set:
|
|
iso_3166_2: FI-01
|
|
name_fi: Ahvenanmaan maakunta
|