-
Notifications
You must be signed in to change notification settings - Fork 1
/
dataone-repo-map.Rmd
82 lines (67 loc) · 2.7 KB
/
dataone-repo-map.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: "dataone-repo-maps"
author: "Matt Jones"
date: "10/17/2017"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
```
# Building a map of DataONE repository locations
We frequently need to update a map of DataONE repositories. Automate the
process to make it simpler to regenerate and tweak on demand, and as new
repositories are added.
## Load repository location data
View the first six repository locations (but the rest are in the table).
```{r location-data, echo=FALSE}
repos <- read.csv("dataone-nodes.csv") %>%
mutate(name=stringi::stri_sub(name,10))
mns <- repos %>% filter(! name == 'CNUCSB1' &! name == 'CNUNM1' &! name == 'CNORC1')
cns <- repos %>% filter(name == 'CNUCSB1' | name == 'CNUNM1' | name == 'CNORC1')
head(mns)
```
## DataONE Member Nodes by year of membership
```{r mn-map-by-year, echo=FALSE, fig.width=10}
library(leaflet)
color_pal <- c("#8B76A2","#817BA6","#7780AA","#6B84AD","#5E89AE","#518DAD","#4491AC","#3695A9","#2998A5","#1F9BA0","#199E9A","#1CA193","#25A38B","#31A483","#3EA67A","#4BA772","#58A869","#65A960","#72A958")
mpal <- colorFactor(
palette = color_pal,
domain = repos$year
)
leaflet(mns) %>%
addTiles() %>%
addProviderTiles("CartoDB.PositronNoLabels") %>%
addCircleMarkers(~lon, ~lat, stroke=FALSE, fillOpacity = 1, radius=7,
fillColor = ~colorFactor(color_pal, year)(year), popup = ~as.character(description)) %>%
addLegend("bottomleft",
pal = mpal,
values = ~year,
title = "Year",
opacity = 1)
```
## DataONE Member Nodes
```{r mn-map, echo=FALSE, fig.width=10in}
leaflet(mns) %>%
addTiles() %>%
addProviderTiles("CartoDB.PositronNoLabels") %>%
addCircleMarkers(~lon, ~lat, stroke=FALSE, fillOpacity = 1,radius=7,
fillColor = "#518DAD", popup = ~as.character(description))
```
## DataONE Coordinating Nodes
```{r cn-map, echo=FALSE}
leaflet(cns) %>%
addTiles() %>%
addProviderTiles("CartoDB.PositronNoLabels") %>%
addCircleMarkers(~lon, ~lat, stroke=FALSE, fillOpacity = 1,
fillColor = "#2F536F", popup = ~as.character(description), label = stringi::stri_sub(~name,10), labelOptions = labelOptions(noHide = TRUE, textSize='36pt', textOnly = TRUE, offset = c(20,-12)))
```
## Cumulative dataset count
```{r}
library(httr2)
library(jsonlite)
query <- 'https://cn.dataone.org/cn/v2/query/solr/?q=formatType:METADATA+AND+-obsoletedBy:*&fl=identifier,dateUploaded&wt=json&rows=0&start=0&facet=true&facet.range=dateUploaded&facet.range.start=2000-01-01T01:01:01Z&facet.range.end=2023-08-31T24:59:59Z&facet.range.gap=%2B1MONTH'
httr2::request(query) |>
httr2::req_perform() |>
httr2::resp_body_json()
```