Skip to content

Instantly share code, notes, and snippets.

@anithegregorian
Created August 24, 2021 21:33
Show Gist options
  • Save anithegregorian/e54e9c5b03401a626c3f923603e86693 to your computer and use it in GitHub Desktop.
Save anithegregorian/e54e9c5b03401a626c3f923603e86693 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
DATA_DIR='./assets/json'
declare -a REGION_LOOKUP
REGION_LOOKUP[1]="Southeast"
REGION_LOOKUP[2]="West"
REGION_LOOKUP[4]="Southwest"
REGION_LOOKUP[5]="Southeast"
REGION_LOOKUP[6]="West"
REGION_LOOKUP[8]="West"
REGION_LOOKUP[9]="Northeast"
REGION_LOOKUP[10]="Northeast"
REGION_LOOKUP[11]="Northeast"
REGION_LOOKUP[12]="Southeast"
REGION_LOOKUP[13]="Southeast"
REGION_LOOKUP[15]="West"
REGION_LOOKUP[16]="West"
REGION_LOOKUP[17]="Midwest"
REGION_LOOKUP[18]="Midwest"
REGION_LOOKUP[19]="Midwest"
REGION_LOOKUP[20]="Midwest"
REGION_LOOKUP[21]="Southeast"
REGION_LOOKUP[22]="Southeast"
REGION_LOOKUP[23]="Northeast"
REGION_LOOKUP[24]="Northeast"
REGION_LOOKUP[25]="Northeast"
REGION_LOOKUP[26]="Midwest"
REGION_LOOKUP[27]="Midwest"
REGION_LOOKUP[28]="Southeast"
REGION_LOOKUP[29]="Midwest"
REGION_LOOKUP[30]="West"
REGION_LOOKUP[31]="Midwest"
REGION_LOOKUP[32]="West"
REGION_LOOKUP[33]="Northeast"
REGION_LOOKUP[34]="Northeast"
REGION_LOOKUP[35]="Southwest"
REGION_LOOKUP[36]="Northeast"
REGION_LOOKUP[37]="Southeast"
REGION_LOOKUP[38]="Midwest"
REGION_LOOKUP[39]="Midwest"
REGION_LOOKUP[40]="Southwest"
REGION_LOOKUP[41]="West"
REGION_LOOKUP[42]="Northeast"
REGION_LOOKUP[44]="Northeast"
REGION_LOOKUP[45]="Southeast"
REGION_LOOKUP[46]="Midwest"
REGION_LOOKUP[47]="Southeast"
REGION_LOOKUP[48]="Southwest"
REGION_LOOKUP[49]="West"
REGION_LOOKUP[50]="Northeast"
REGION_LOOKUP[51]="Southeast"
REGION_LOOKUP[53]="West"
REGION_LOOKUP[54]="Southeast"
REGION_LOOKUP[55]="Midwest"
REGION_LOOKUP[56]="West"
toposimplify -p 0.1 -f \
< $DATA_DIR/us.json \
| topomerge regions=states -k "$REGION_LOOKUP[+d.id]" \
> $DATA_DIR/us-regions.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment