feat(country-map): Adds Philippines regional map and updates/cleans existing Philippines provincial map (#27933)

This commit is contained in:
jdrui 2024-04-26 03:25:49 +08:00 committed by GitHub
parent 4afeabe042
commit ce1d18e534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 181 additions and 112 deletions

View File

@ -283,6 +283,7 @@
" 'paraguay',\n",
" 'peru',\n",
" 'philippines',\n",
" 'philippines_regions', # this one is derived from philippines - see below\n",
" 'portugal',\n",
" 'poland',\n",
" 'puerto rico',\n",
@ -1111,9 +1112,87 @@
},
{
"cell_type": "markdown",
"metadata": {
"id": "Fb58eGlIt1LW"
},
"metadata": {},
"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": [
"## Output GeoJSON"
]

View File

@ -80,6 +80,7 @@ import papua_new_guinea from './countries/papua_new_guinea.geojson';
import paraguay from './countries/paraguay.geojson';
import peru from './countries/peru.geojson';
import philippines from './countries/philippines.geojson';
import philippines_regions from './countries/philippines_regions.geojson';
import portugal from './countries/portugal.geojson';
import poland from './countries/poland.geojson';
import puerto_rico from './countries/puerto_rico.geojson';
@ -178,6 +179,7 @@ export const countries = {
paraguay,
peru,
philippines,
philippines_regions,
portugal,
poland,
puerto_rico,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long