mirror of
https://github.com/apache/superset.git
synced 2026-05-29 20:29:34 +00:00
feat(plugin-chart-country-map): ship all 33 NE worldviews at Admin 0
Previously the build only emitted the ukr (Ukraine) worldview, so the worldview dropdown had a single option even though it claimed otherwise. Build now produces Admin 0 GeoJSON for every NE-published editorial: default, arg, bdg, bra, chn, deu, egy, esp, fra, gbr, grc, idn, ind, iso, isr, ita, jpn, kor, mar, nep, nld, pak, pol, prt, pse, rus, sau, swe, tur, twn, ukr, usa, vnm (33 total). NE does not publish per-worldview Admin 1 variants, so subdivisions within a country come from a single shared file. The frontend now always points Admin 1, regional aggregation, and composite URLs at the ukr-prefixed shared outputs regardless of the selected worldview — the worldview control only affects the world (Admin 0) map. - build.py: expand WORLDVIEWS_ADMIN_0 to 33 worldviews; main() builds Admin 0 for all of them, Admin 1 only for ukr - transformProps.ts: introduce SHARED_ADMIN1_WORLDVIEW = 'ukr'; pin all non-Admin-0 URLs to it - controlPanel.tsx: WORLDVIEW_LABELS now covers all 33 codes; unrecognized codes still fall back to raw code for forward-compat - transformProps.test.ts: cover shared-Admin1 contract (admin1+chn still resolves to ukr_admin1_*) - pre-commit: exclude .geo.json from check-added-large-files (existing rule only excluded .geojson and would block these ~2MB worldview files) - README + SIP: document the worldview model and check off Phase 1 item Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,26 @@ scripts/
|
||||
output/ # gitignored — build artifacts
|
||||
```
|
||||
|
||||
## Worldviews
|
||||
|
||||
Natural Earth publishes per-country editorial variants of its Admin 0
|
||||
(countries) layer: `ne_10m_admin_0_countries_<code>.shp`. Each variant
|
||||
encodes that country's official stance on disputed borders — e.g.
|
||||
`ne_10m_admin_0_countries_ukr.shp` shows Crimea as Ukrainian; `_chn`
|
||||
shows Taiwan as part of China; `_iso` uses neutral ISO 3166-1 boundaries.
|
||||
|
||||
`build.py` builds Admin 0 for every NE-published worldview listed in
|
||||
the `WORLDVIEWS_ADMIN_0` constant — outputs are named
|
||||
`<worldview>_admin0.geo.json`. The plugin's worldview control reads the
|
||||
list from `manifest.json` and shows whatever the build produced.
|
||||
|
||||
NE does **not** publish per-worldview Admin 1 variants — subdivisions
|
||||
within a country come from a single global file. We build Admin 1 once
|
||||
(under the `ukr` filename prefix for back-compat) and the frontend
|
||||
always points Admin 1, regional, and composite URLs at that shared
|
||||
output regardless of which worldview the user has selected. The
|
||||
worldview choice only changes the country-borders map (Admin 0).
|
||||
|
||||
## Operating principles
|
||||
|
||||
- **Default tool: declarative YAML.** Most touchups are renames, repositions, dissolves, or filters — all expressible in YAML. Diffs are small, conflicts localize cleanly to one entry, contributors can submit "fix typo X" as a one-line PR.
|
||||
|
||||
@@ -79,12 +79,52 @@ OUTPUT_DIR = REPO_ROOT / "superset" / "static" / "assets" / "country-maps"
|
||||
|
||||
SHAPEFILE_EXTS = ["shp", "shx", "dbf", "prj", "cpg"]
|
||||
|
||||
# Worldview codes shipped by NE as suffixes on the Admin 0 file name. Empty
|
||||
# string = the "Default" (ungrouped) NE editorial. The new plugin's
|
||||
# documented default is "ukr".
|
||||
# Worldview codes shipped by Natural Earth as filename suffixes on the
|
||||
# Admin 0 layer. Empty string = NE's "Default" editorial; every other
|
||||
# entry maps 1-to-1 to a file `ne_10m_admin_0_countries_<code>.shp`
|
||||
# published at the pinned NE tag. Adding a code here is all it takes to
|
||||
# expose a new worldview in the chart's dropdown — provided NE actually
|
||||
# publishes that suffix at the pinned version.
|
||||
#
|
||||
# Admin 1 (subdivisions within a country) is published by NE as a single
|
||||
# global file with no worldview variants, so subdivision boundaries
|
||||
# don't change with the worldview choice. That means we build Admin 1
|
||||
# once (under the "ukr" name for back-compat with earlier output) and
|
||||
# the frontend always points Admin 1 URLs at that shared output.
|
||||
WORLDVIEWS_ADMIN_0 = [
|
||||
"", # Default
|
||||
"", # Default — NE's ungrouped editorial baseline
|
||||
"arg", # Argentina
|
||||
"bdg", # Bangladesh (NE uses bdg, ISO code is BGD)
|
||||
"bra", # Brazil
|
||||
"chn", # China
|
||||
"deu", # Germany
|
||||
"egy", # Egypt
|
||||
"esp", # Spain
|
||||
"fra", # France
|
||||
"gbr", # United Kingdom
|
||||
"grc", # Greece
|
||||
"idn", # Indonesia
|
||||
"ind", # India
|
||||
"iso", # ISO 3166-1 (neutral / UN-style boundaries)
|
||||
"isr", # Israel
|
||||
"ita", # Italy
|
||||
"jpn", # Japan
|
||||
"kor", # South Korea
|
||||
"mar", # Morocco
|
||||
"nep", # Nepal
|
||||
"nld", # Netherlands
|
||||
"pak", # Pakistan
|
||||
"pol", # Poland
|
||||
"prt", # Portugal
|
||||
"pse", # Palestine
|
||||
"rus", # Russia
|
||||
"sau", # Saudi Arabia
|
||||
"swe", # Sweden
|
||||
"tur", # Türkiye
|
||||
"twn", # Taiwan
|
||||
"ukr", # Ukraine — Superset's documented default
|
||||
"usa", # United States
|
||||
"vnm", # Vietnam
|
||||
]
|
||||
|
||||
|
||||
@@ -1027,12 +1067,12 @@ def main() -> int:
|
||||
f"Loaded composite_maps: {len(composite_maps.get('composites', {}))} composites"
|
||||
)
|
||||
|
||||
# POC scope: UA worldview, both Admin 0 and Admin 1. Future commits
|
||||
# add more worldviews (Default, and other major NE worldviews).
|
||||
targets: list[tuple[str, int]] = [
|
||||
("ukr", 0),
|
||||
("ukr", 1), # Admin 1 — exercises name_overrides + per-country fly-island rules
|
||||
]
|
||||
# Build Admin 0 for every NE-published worldview, plus Admin 1 only
|
||||
# for the documented default ("ukr"). NE's Admin 1 layer has no
|
||||
# worldview variants, so subdivisions are worldview-agnostic and the
|
||||
# frontend always references the ukr_admin1_<country> files.
|
||||
targets: list[tuple[str, int]] = [(wv, 0) for wv in WORLDVIEWS_ADMIN_0]
|
||||
targets.append(("ukr", 1))
|
||||
|
||||
for worldview, admin_level in targets:
|
||||
build_one(
|
||||
|
||||
Reference in New Issue
Block a user