mirror of https://github.com/apache/superset.git
feat(country-map): Adds Philippines regional map and updates/cleans existing Philippines provincial map (#27933)
This commit is contained in:
parent
4afeabe042
commit
ce1d18e534
|
@ -283,6 +283,7 @@
|
||||||
" 'paraguay',\n",
|
" 'paraguay',\n",
|
||||||
" 'peru',\n",
|
" 'peru',\n",
|
||||||
" 'philippines',\n",
|
" 'philippines',\n",
|
||||||
|
" 'philippines_regions', # this one is derived from philippines - see below\n",
|
||||||
" 'portugal',\n",
|
" 'portugal',\n",
|
||||||
" 'poland',\n",
|
" 'poland',\n",
|
||||||
" 'puerto rico',\n",
|
" 'puerto rico',\n",
|
||||||
|
@ -1111,9 +1112,87 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"id": "Fb58eGlIt1LW"
|
"source": [
|
||||||
|
"### Philippines\n",
|
||||||
|
"- Merges highly urbanized cities (HUCs) into their respective geographic provinces\n",
|
||||||
|
"- Updates provinces:\n",
|
||||||
|
" - Forms Maguindanao del Norte and Maguindanao del Sur from the former Maguindanao province\n",
|
||||||
|
" - Splits off Davao Occidental from Davao del Sur\n",
|
||||||
|
" - Renames Compostella Valley to Davao de Oro"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"ph_url = \"https://raw.githubusercontent.com/jdruii/phgeojson/main/philippines.geojson\"\n",
|
||||||
|
"philippines_copy = gpd.read_file(ph_url)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"philippines_copy = philippines_copy.rename(columns={'NAME_1': 'name','ISO': 'iso_3166_2'})\n",
|
||||||
|
"philippines_copy.plot()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"#### Philippines Regions\n",
|
||||||
|
"- Adds regional map\n",
|
||||||
|
" - Fixes outdated names"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"philippines_regions = df[df.admin == 'Philippines'][['geometry','region_cod','region']]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"philippines_regions = philippines_regions.dissolve(by=['region_cod', 'region']).reset_index()\n",
|
||||||
|
"philippines_regions = philippines_regions.rename(columns={'region': 'name', 'region_cod': 'iso_3166_2'})"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"philippines_regions['name'].replace({'Dinagat Islands (Region XIII)': 'Caraga Administrative Region (Region XIII)', \n",
|
||||||
|
" 'Autonomous Region in Muslim Mindanao (ARMM)': 'Bangsamoro Autonomous Region in Muslim Mindanao (BARMM)'}, \n",
|
||||||
|
" inplace=True)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"philippines_regions.plot(figsize = (10, 7), edgecolor='black', column='iso_3166_2', legend=False, cmap='tab20')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Output GeoJSON"
|
"## Output GeoJSON"
|
||||||
]
|
]
|
||||||
|
|
|
@ -80,6 +80,7 @@ import papua_new_guinea from './countries/papua_new_guinea.geojson';
|
||||||
import paraguay from './countries/paraguay.geojson';
|
import paraguay from './countries/paraguay.geojson';
|
||||||
import peru from './countries/peru.geojson';
|
import peru from './countries/peru.geojson';
|
||||||
import philippines from './countries/philippines.geojson';
|
import philippines from './countries/philippines.geojson';
|
||||||
|
import philippines_regions from './countries/philippines_regions.geojson';
|
||||||
import portugal from './countries/portugal.geojson';
|
import portugal from './countries/portugal.geojson';
|
||||||
import poland from './countries/poland.geojson';
|
import poland from './countries/poland.geojson';
|
||||||
import puerto_rico from './countries/puerto_rico.geojson';
|
import puerto_rico from './countries/puerto_rico.geojson';
|
||||||
|
@ -178,6 +179,7 @@ export const countries = {
|
||||||
paraguay,
|
paraguay,
|
||||||
peru,
|
peru,
|
||||||
philippines,
|
philippines,
|
||||||
|
philippines_regions,
|
||||||
portugal,
|
portugal,
|
||||||
poland,
|
poland,
|
||||||
puerto_rico,
|
puerto_rico,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue