How to get the list of contacts from list of DEIMS ID within csv file
Alessandro Oggioni, Paolo Tagliolato
Source:vignettes/sites_contacts.Rmd
sites_contacts.Rmd
Starting from the DEIMS-SDR “Advanced Search - Sites” interface, an user can download a csv file of the sites. Some filters can be used for selecting sites based on countries, projects, Biome, etc. The list of sites selected can be downloaded in csv format file.
This documentation, starting from this file csv, shows how to:
List of the contacts
- obtain the list of contacts for each site
library(dplyr)
site_results <- read.csv("./data/site_contacts_data.csv", sep = ";") %>%
dplyr::as_tibble() %>%
dplyr::mutate(url = paste0("https://deims.org/", DEIMS.ID))
contacts <- site_results$url %>%
purrr::map_dfr(.f = function(x) {
x %>% ReLTER::get_site_info(category = "Contacts") %>%
dplyr::select(title, uri, generalInfo.siteManager, geoCoord) %>%
tidyr::unnest()
}) %>%
dplyr::mutate(
site = paste0("[", title, "](", uri, ")"),
contact = paste0("[", name, "](mailto:", email, ")")
) %>%
unique()
# Contacts table
knitr::kable(
(contacts %>% dplyr::select(site, contact)),
caption = "List of the contacts",
booktabs = TRUE, longtable = TRUE
)
Map of the sites
- how to map the sites selected
library(dplyr)
site_results_geo <- sf::st_as_sf(
contacts,
wkt = "geoCoord"
)
listItaSitesMap <- leaflet::leaflet(site_results_geo) %>%
leaflet::addProviderTiles(provider = "CartoDB.PositronNoLabels",
group = "Basemap",
layerId = 123) %>%
leaflet::addTiles("http://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}.png") %>%
leaflet::addCircleMarkers(
data = site_results_geo,
radius = 3,
weight = 2,
opacity = 0.5,
fill = TRUE,
fillOpacity = 0.2,
popup = paste0(
'<b>eLTER site: </b><br><a href="',
site_results_geo$uri, '">', site_results_geo$title, '</a><br>',
'<b>Contact:</b> <br><a href="mailto:', site_results_geo$email, '">',
site_results_geo$name, '</a>'
)
)
listItaSitesMap