Skip to content

Commit dab5443

Browse files
committed
#2828 update notebook with documentation
1 parent 13df8d3 commit dab5443

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

talkmap.ipynb

+20-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@
66
"source": [
77
"# Leaflet cluster map of talk locations\n",
88
"\n",
9-
"Run this from the _talks/ directory, which contains .md files of all your talks. This scrapes the location YAML field from each .md file, geolocates it with geopy/Nominatim, and uses the getorg library to output data, HTML, and Javascript for a standalone cluster map."
9+
"Assuming you are working in a Linux or Windows Subsystem for Linux environment, you may need to install some dependencies. Assuming a clean installation, the following will be needed:\n",
10+
"\n",
11+
"```bash\n",
12+
"sudo apt install jupyter\n",
13+
"sudo apt install python3-pip\n",
14+
"pip install getorg --upgrade\n",
15+
"```\n",
16+
"\n",
17+
"After which you can run this from the `_talks/` directory, via:\n",
18+
"\n",
19+
"```bash\n",
20+
" jupyter nbconvert --to notebook --execute talkmap.ipynb --output talkmap_out.ipynb\n",
21+
"```\n",
22+
" \n",
23+
"The `_talks/` directory contains `.md` files of all your talks. This scrapes the location YAML field from each `.md` file, geolocates it with `geopy/Nominatim`, and uses the `getorg` library to output data, HTML, and Javascript for a standalone cluster map."
1024
]
1125
},
1226
{
@@ -17,6 +31,7 @@
1731
},
1832
"outputs": [],
1933
"source": [
34+
"# Start by installing the dependencies\n",
2035
"!pip install getorg --upgrade\n",
2136
"import glob\n",
2237
"import getorg\n",
@@ -31,6 +46,7 @@
3146
},
3247
"outputs": [],
3348
"source": [
49+
"# Collect the Markdown files\n",
3450
"g = glob.glob(\"*.md\")"
3551
]
3652
},
@@ -42,6 +58,7 @@
4258
},
4359
"outputs": [],
4460
"source": [
61+
"# Prepare to geolocate\n",
4562
"geocoder = Nominatim(user_agent=\"academicpages.github.io\")\n",
4663
"location_dict = {}\n",
4764
"location = \"\"\n",
@@ -57,7 +74,7 @@
5774
},
5875
"outputs": [],
5976
"source": [
60-
"\n",
77+
"# Perform geolocation\n",
6178
"for file in g:\n",
6279
" with open(file, 'r') as f:\n",
6380
" lines = f.read()\n",
@@ -80,6 +97,7 @@
8097
},
8198
"outputs": [],
8299
"source": [
100+
"# Save the map\n",
83101
"m = getorg.orgmap.create_map_obj()\n",
84102
"getorg.orgmap.output_html_cluster_map(location_dict, folder_name=\"../talkmap\", hashed_usernames=False)"
85103
]

0 commit comments

Comments
 (0)