summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/map/index.js16
-rw-r--r--scraper/s2-geocode-spreadsheet.py4
-rw-r--r--scraper/s2-geocode.py14
-rw-r--r--site/assets/css/css.css12
4 files changed, 35 insertions, 11 deletions
diff --git a/client/map/index.js b/client/map/index.js
index 4b922ec5..a9afe211 100644
--- a/client/map/index.js
+++ b/client/map/index.js
@@ -37,13 +37,19 @@ const redDot = L.icon({
popupAnchor: [0, -5] // point from which the popup should open relative to the iconAnchor
})
-function addMarker(map, latlng, title, subtext) {
+function addMarker(map, latlng, title, subtext, year) {
const marker = L.marker(latlng, { icon: redDot }).addTo(map)
- marker.bindPopup([
+ let message = [
"<b>", title, "</b>",
+ ]
+ message = message.concat([
"<br>",
subtext,
- ].join(''))
+ ])
+ if (year) {
+ message.push(" (" + year + ")")
+ }
+ marker.bindPopup(message.join(''))
return marker
}
@@ -86,13 +92,13 @@ export default function append(el, payload) {
const citationAddress = citation.addresses[0]
const latlng = [citationAddress.lat, citationAddress.lng].map(n => parseFloat(n))
if (Number.isNaN(latlng[0]) || Number.isNaN(latlng[1])) return
- addMarker(map, latlng, citation.title, citationAddress.name)
+ addMarker(map, latlng, citation.title, citationAddress.name, citation.year)
addArc(map, source, latlng, arcStyles[citationAddress.type])
})
console.log(paper)
- const rootMarker = addMarker(map, source, paper.title, paper.address)
+ const rootMarker = addMarker(map, source, paper.title, address.name, paper.year)
rootMarker.openPopup()
// a transparent div to cover the map, so normal scroll events will not be eaten by leaflet
diff --git a/scraper/s2-geocode-spreadsheet.py b/scraper/s2-geocode-spreadsheet.py
index b9f148a3..375c8fde 100644
--- a/scraper/s2-geocode-spreadsheet.py
+++ b/scraper/s2-geocode-spreadsheet.py
@@ -111,6 +111,8 @@ def update_country_from_address(address, i, countries, worksheet):
country = countries[possible_country]
elif "China" in address:
country = "China"
+ elif "Hong Kong" in address:
+ country = "China"
elif "Singapore" in address:
country = "Singapore"
elif "Taiwan" in address:
@@ -119,6 +121,8 @@ def update_country_from_address(address, i, countries, worksheet):
country = "Russia"
elif "Ukraine" in address:
country = "Ukraine"
+ elif "Hungary" in address:
+ country = "Hungary"
elif "Japan" in address:
country = "Japan"
elif "Iran" in address:
diff --git a/scraper/s2-geocode.py b/scraper/s2-geocode.py
index e1f012c9..b9c31d64 100644
--- a/scraper/s2-geocode.py
+++ b/scraper/s2-geocode.py
@@ -21,6 +21,18 @@ def s2_geocode(fn):
countries = load_countries()
# print(fn)
+ cname_lookup = {}
+ name_lookup = {}
+ institution_keys, institution_rows = fetch_google_sheet("institutions")
+ for i, row in enumerate(institution_rows):
+ # row_tuples.append((i, row,))
+ cname, name, address, lat, lng, org_type, extra_address, country = row
+ if len(cname) < 3:
+ print("very short cname: {}".format(cname))
+ if cname == name or cname not in cname_lookup:
+ cname_lookup[cname] = i
+ name_lookup[name] = True
+ print("built lookup")
rows = read_csv(fn, keys=False)
valid = read_csv('./reports/doi_institutions_geocoded.csv', keys=False, create=True)
@@ -34,6 +46,8 @@ def s2_geocode(fn):
if not name or len(name) < 2 or name in countries:
print("weird name: {}".format(name))
continue
+ if name in cname_lookup or name in name_lookup:
+ continue
try:
location = geolocator.geocode(name)
except:
diff --git a/site/assets/css/css.css b/site/assets/css/css.css
index 91d75599..b8798cd9 100644
--- a/site/assets/css/css.css
+++ b/site/assets/css/css.css
@@ -675,14 +675,14 @@ page-specific formatting
display: inline-block;
margin-right: 10px
}
-.edu{
- color:#f30000;
+.edu {
+ color: #f2f293;
}
-.com{
- color:#f2f293;
+.com {
+ color: #3264f6;
}
-.gov{
- color:#3264f6;
+.gov {
+ color: #f30000;
}
/* about */