|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "markdown",
|
5 |
| - "source": "# `folium` Interactive Map Demo\n\nSimple demonstration of rendering a map in a `jupyterlite` notebook.\n\nNote that the `folium` package has several dependencies which themselves may have dependencies.\n\nThe following code fragement, run in a fresh Python enviroment into which `folium` has already been installed, identifies the packages that are loaded in when `folium` is loaded:\n\n```python\n#https://stackoverflow.com/a/40381601/454773\nimport sys\nbefore = [str(m) for m in sys.modules]\nimport folium\nafter = [str(m) for m in sys.modules]\nset([m.split('.')[0] for m in after if not m in before and not m.startswith('_')])\n```\n\nThe loaded packages are:\n\n```\n{'branca',\n 'certifi',\n 'chardet',\n 'cmath',\n 'csv',\n 'dateutil',\n 'encodings',\n 'folium',\n 'gzip',\n 'http',\n 'idna',\n 'importlib',\n 'jinja2',\n 'markupsafe',\n 'mmap',\n 'numpy',\n 'pandas',\n 'pkg_resources',\n 'pytz',\n 'requests',\n 'secrets',\n 'stringprep',\n 'urllib3',\n 'zipfile'}\n ```\n ", |
6 | 5 | "metadata": {
|
7 | 6 | "tags": []
|
8 |
| - } |
| 7 | + }, |
| 8 | + "source": [ |
| 9 | + "# `folium` Interactive Map Demo\n", |
| 10 | + "\n", |
| 11 | + "Simple demonstration of rendering a map in a `jupyterlite` notebook.\n", |
| 12 | + "\n", |
| 13 | + "Note that the `folium` package has several dependencies which themselves may have dependencies.\n", |
| 14 | + "\n", |
| 15 | + "The following code fragement, run in a fresh Python enviroment into which `folium` has already been installed, identifies the packages that are loaded in when `folium` is loaded:\n", |
| 16 | + "\n", |
| 17 | + "```python\n", |
| 18 | + "#https://stackoverflow.com/a/40381601/454773\n", |
| 19 | + "import sys\n", |
| 20 | + "before = [str(m) for m in sys.modules]\n", |
| 21 | + "import folium\n", |
| 22 | + "after = [str(m) for m in sys.modules]\n", |
| 23 | + "set([m.split('.')[0] for m in after if not m in before and not m.startswith('_')])\n", |
| 24 | + "```\n", |
| 25 | + "\n", |
| 26 | + "The loaded packages are:\n", |
| 27 | + "\n", |
| 28 | + "```\n", |
| 29 | + "{'branca',\n", |
| 30 | + " 'certifi',\n", |
| 31 | + " 'chardet',\n", |
| 32 | + " 'cmath',\n", |
| 33 | + " 'csv',\n", |
| 34 | + " 'dateutil',\n", |
| 35 | + " 'encodings',\n", |
| 36 | + " 'folium',\n", |
| 37 | + " 'gzip',\n", |
| 38 | + " 'http',\n", |
| 39 | + " 'idna',\n", |
| 40 | + " 'importlib',\n", |
| 41 | + " 'jinja2',\n", |
| 42 | + " 'markupsafe',\n", |
| 43 | + " 'mmap',\n", |
| 44 | + " 'numpy',\n", |
| 45 | + " 'pandas',\n", |
| 46 | + " 'pkg_resources',\n", |
| 47 | + " 'pytz',\n", |
| 48 | + " 'requests',\n", |
| 49 | + " 'secrets',\n", |
| 50 | + " 'stringprep',\n", |
| 51 | + " 'urllib3',\n", |
| 52 | + " 'zipfile'}\n", |
| 53 | + " ```\n", |
| 54 | + " " |
| 55 | + ] |
9 | 56 | },
|
10 | 57 | {
|
11 | 58 | "cell_type": "markdown",
|
12 |
| - "source": "The following packages seem to need installing in order load `folium`, along with folium itself:\n\n```\nchardet, certifi, idna, branca, urllib3, Jinja2, requests, Markupsafe\n```\n\nUniversal wheels, with filenames of the form `PACKAGE-VERSION-py2.py3-none-any.whl` appearing in the *Download files* area of a PyPi package page ([example](https://pypi.org/project/requests/#files)] are required in order to install the package.\n\nOne required package, [`Markupsafe`](https://pypi.org/project/Markupsafe/#files)) *did not* have a universal wheel available, so a wheel was manually built elsewhere (by hacking the [`setup.py` file](https://github.com/pallets/markupsafe/blob/main/setup.py) to force it to build the wheel in a platform and speedup free way) and pushed to a downloadable location in an [*ad hoc* wheelhouse](https://opencomputinglab.github.io/vce-wheelhouse/).", |
13 |
| - "metadata": {} |
| 59 | + "metadata": {}, |
| 60 | + "source": [ |
| 61 | + "The following packages seem to need installing in order load `folium`, along with folium itself:\n", |
| 62 | + "\n", |
| 63 | + "```\n", |
| 64 | + "chardet, certifi, idna, branca, urllib3, Jinja2, requests, Markupsafe\n", |
| 65 | + "```\n", |
| 66 | + "\n", |
| 67 | + "Universal wheels, with filenames of the form `PACKAGE-VERSION-py2.py3-none-any.whl` appearing in the *Download files* area of a PyPi package page ([example](https://pypi.org/project/requests/#files)] are required in order to install the package.\n", |
| 68 | + "\n", |
| 69 | + "One required package, [`Markupsafe`](https://pypi.org/project/Markupsafe/#files)) *did not* have a universal wheel available, so a wheel was manually built elsewhere (by hacking the [`setup.py` file](https://github.com/pallets/markupsafe/blob/main/setup.py) to force it to build the wheel in a platform and speedup free way) and pushed to a downloadable location in an [*ad hoc* wheelhouse](https://opencomputinglab.github.io/vce-wheelhouse/)." |
| 70 | + ] |
14 | 71 | },
|
15 | 72 | {
|
16 | 73 | "cell_type": "code",
|
17 |
| - "source": "# Install folium requirements\nimport piplite\nawait piplite.install(\"https://opencomputinglab.github.io/vce-wheelhouse/wheelhouse/MarkupSafe-2.0.1-py2.py3-none-any.whl\")\nawait piplite.install('https://files.pythonhosted.org/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl')\nawait piplite.install('https://files.pythonhosted.org/packages/05/1b/0a0dece0e8aa492a6ec9e4ad2fe366b511558cdc73fd3abc82ba7348e875/certifi-2021.5.30-py2.py3-none-any.whl')\nawait piplite.install('https://files.pythonhosted.org/packages/d7/77/ff688d1504cdc4db2a938e2b7b9adee5dd52e34efbd2431051efc9984de9/idna-3.2-py3-none-any.whl')\nawait piplite.install(\"https://files.pythonhosted.org/packages/61/1f/570b0615c452265d57e4114e633231d6cd9b9d275256778a675681e4f711/branca-0.4.2-py3-none-any.whl\")\nawait piplite.install('https://files.pythonhosted.org/packages/0c/cd/1e2ec680ec7b09846dc6e605f5a7709dfb9d7128e51a026e7154e18a234e/urllib3-1.26.5-py2.py3-none-any.whl')\nawait piplite.install('https://files.pythonhosted.org/packages/80/21/ae597efc7ed8caaa43fb35062288baaf99a7d43ff0cf66452ddf47604ee6/Jinja2-3.0.1-py3-none-any.whl')\nawait piplite.install('https://files.pythonhosted.org/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl')\n\n# Install folium \nawait piplite.install(\"https://files.pythonhosted.org/packages/c3/83/e8cb37afc2f016a1cf4caab8d22caf7fe4156c4c15230d8abc9c83547e0c/folium-0.12.1-py2.py3-none-any.whl\")", |
| 74 | + "execution_count": null, |
18 | 75 | "metadata": {
|
19 | 76 | "trusted": true
|
20 | 77 | },
|
21 |
| - "execution_count": null, |
22 |
| - "outputs": [] |
| 78 | + "outputs": [], |
| 79 | + "source": [ |
| 80 | + "# Install folium requirements\n", |
| 81 | + "%pip install -q folium" |
| 82 | + ] |
23 | 83 | },
|
24 | 84 | {
|
25 | 85 | "cell_type": "markdown",
|
26 |
| - "source": "## Demo of `folium` Map\n\nLoad in the `folium` package:", |
27 |
| - "metadata": {} |
| 86 | + "metadata": {}, |
| 87 | + "source": [ |
| 88 | + "## Demo of `folium` Map\n", |
| 89 | + "\n", |
| 90 | + "Load in the `folium` package:" |
| 91 | + ] |
28 | 92 | },
|
29 | 93 | {
|
30 | 94 | "cell_type": "code",
|
31 |
| - "source": "import folium", |
| 95 | + "execution_count": null, |
32 | 96 | "metadata": {
|
33 | 97 | "trusted": true
|
34 | 98 | },
|
35 |
| - "execution_count": null, |
36 |
| - "outputs": [] |
| 99 | + "outputs": [], |
| 100 | + "source": [ |
| 101 | + "import folium" |
| 102 | + ] |
37 | 103 | },
|
38 | 104 | {
|
39 | 105 | "cell_type": "markdown",
|
40 |
| - "source": "And render a demo map:", |
41 |
| - "metadata": {} |
| 106 | + "metadata": {}, |
| 107 | + "source": [ |
| 108 | + "And render a demo map:" |
| 109 | + ] |
42 | 110 | },
|
43 | 111 | {
|
44 | 112 | "cell_type": "code",
|
45 |
| - "source": "m = folium.Map(location=[50.693848, -1.304734], zoom_start=11)\nm", |
| 113 | + "execution_count": null, |
46 | 114 | "metadata": {
|
47 | 115 | "trusted": true
|
48 | 116 | },
|
49 |
| - "execution_count": null, |
50 |
| - "outputs": [] |
| 117 | + "outputs": [], |
| 118 | + "source": [ |
| 119 | + "m = folium.Map(location=[50.693848, -1.304734], zoom_start=11)\n", |
| 120 | + "m" |
| 121 | + ] |
51 | 122 | },
|
52 | 123 | {
|
53 | 124 | "cell_type": "code",
|
54 |
| - "source": "", |
55 |
| - "metadata": {}, |
56 | 125 | "execution_count": null,
|
57 |
| - "outputs": [] |
| 126 | + "metadata": {}, |
| 127 | + "outputs": [], |
| 128 | + "source": [] |
58 | 129 | }
|
59 | 130 | ],
|
60 | 131 | "metadata": {
|
|
0 commit comments