File tree 1 file changed +47
-0
lines changed 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+
3
+ # # Leaflet cluster map of talk locations
4
+ #
5
+ # (c) 2016-2017 R. Stuart Geiger, released under the MIT license
6
+ #
7
+ # Run this from the _talks/ directory, which contains .md files of all your talks.
8
+ # This scrapes the location YAML field from each .md file, geolocates it with
9
+ # geopy/Nominatim, and uses the getorg library to output data, HTML,
10
+ # and Javascript for a standalone cluster map.
11
+ #
12
+ # Requires: glob, getorg, geopy
13
+
14
+ import glob
15
+ import getorg
16
+ from geopy import Nominatim
17
+
18
+ g = glob .glob ("*.md" )
19
+
20
+
21
+ geocoder = Nominatim ()
22
+ location_dict = {}
23
+ location = ""
24
+ permalink = ""
25
+ title = ""
26
+
27
+
28
+ for file in g :
29
+ with open (file , 'r' ) as f :
30
+ lines = f .read ()
31
+ if lines .find ('location: "' ) > 1 :
32
+ loc_start = lines .find ('location: "' ) + 11
33
+ lines_trim = lines [loc_start :]
34
+ loc_end = lines_trim .find ('"' )
35
+ location = lines_trim [:loc_end ]
36
+
37
+
38
+ location_dict [location ] = geocoder .geocode (location )
39
+ print (location , "\n " , location_dict [location ])
40
+
41
+
42
+ m = getorg .orgmap .create_map_obj ()
43
+ getorg .orgmap .output_html_cluster_map (location_dict , folder_name = "../talkmap" , hashed_usernames = False )
44
+
45
+
46
+
47
+
You can’t perform that action at this time.
0 commit comments