Files
superset2/superset-frontend/plugins/plugin-chart-country-map
Evan Rusackas 1e77ff1706 feat(country-map): build script — regional_aggregations transform
Implements the fourth transform: dissolve Admin 1 subdivisions into
coarser administrative regions. Supports two mapping styles:
- explicit_mapping: per-region {name, members: [iso_3166_2, ...]}
- grouping_field: dissolve by an existing NE field (e.g. region_cod)

Verified counts match notebook expectations exactly:
  TUR/nuts_1:  81 subdivisions → 12 regions → 23 KB
  FRA/regions: 101 subdivisions → 18 regions → 32 KB
  ITA/regions: 110 subdivisions → 20 regions → 32 KB
  PHL/regions: 118 subdivisions → 17 regions → 32 KB

Per-region-set output is its own file (`regional_<country>_<set>_
<worldview>.geo.json`) so the plugin can lazy-load only what's needed
for the current chart.

Implementation:
- Filter base geo to country features
- Tag each with derived `_region_code` and `_region_name` (via reverse
  lookup of explicit_mapping, or via grouping_field value)
- mapshaper -dissolve handles the polygon merging in one pass
- Rename derived fields → standard `iso_3166_2` and `name` on output

Output sizes are tiny — each per-chart payload becomes ~30 KB instead
of pulling the full Admin 1 layer.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 16:29:44 -07:00
..