Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spatialthoughts committed Jul 3, 2024
1 parent ef0f5c8 commit 7d5bb8a
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions code/python_dataviz/supplement_labeling_features.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@
"source": [
"%%capture\n",
"if 'google.colab' in str(get_ipython()):\n",
" !apt install libspatialindex-dev\n",
" !pip install fiona shapely pyproj rtree mapclassify\n",
" !pip install geopandas"
" !pip install mapclassify"
],
"metadata": {
"id": "QYAcw2IjHVzi"
},
"id": "QYAcw2IjHVzi",
"execution_count": 1,
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "df487246-fb38-451f-a76d-ffbb7ad95a0f",
"metadata": {
"id": "df487246-fb38-451f-a76d-ffbb7ad95a0f"
Expand All @@ -67,7 +65,7 @@
"id": "lOLD5d1yHZIC"
},
"id": "lOLD5d1yHZIC",
"execution_count": 4,
"execution_count": null,
"outputs": []
},
{
Expand All @@ -76,32 +74,33 @@
"def download(url):\n",
" filename = os.path.join(data_folder, os.path.basename(url))\n",
" if not os.path.exists(filename):\n",
" from urllib.request import urlretrieve\n",
" local, _ = urlretrieve(url, filename)\n",
" print('Downloaded ' + local)\n",
"\n",
" with requests.get(url, stream=True, allow_redirects=True) as r:\n",
" with open(filename, 'wb') as f:\n",
" for chunk in r.iter_content(chunk_size=8192):\n",
" f.write(chunk)\n",
" print('Downloaded', filename)"
],
"metadata": {
"id": "jt6qUdRz95GA"
},
"id": "jt6qUdRz95GA",
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"filename = 'karnataka.gpkg'\n",
"data_url = 'https://github.com/spatialthoughts/python-dataviz-web/raw/main/data/osm/'\n",
"data_url = 'https://github.com/spatialthoughts/python-dataviz-web/releases/' \\\n",
" 'download/bangalore/'\n",
"download(data_url + filename)\n"
],
"metadata": {
"id": "1PVxJlqkHb0q",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "6185adb2-12ac-489d-a599-a8cf310c076a"
"id": "1PVxJlqkHb0q"
},
"id": "1PVxJlqkHb0q",
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Downloaded data/karnataka.gpkg\n"
]
}
]
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -133,7 +132,7 @@
"id": "PyOeN8aneCa6"
},
"id": "PyOeN8aneCa6",
"execution_count": 7,
"execution_count": null,
"outputs": []
},
{
Expand Down Expand Up @@ -210,7 +209,7 @@
"outputId": "cfe44aef-3d87-4a9a-a637-48a429b223bf"
},
"id": "MIDnKtEwgBsF",
"execution_count": 17,
"execution_count": null,
"outputs": [
{
"output_type": "display_data",
Expand Down

0 comments on commit 7d5bb8a

Please sign in to comment.