Taking into account the guide on "How to obtain site info?", here is offered two examples on how to aggregate information of many eLTER sites.

By get_network_* functions: {#firstExample}

Through the 5 functions developed for get network information, access and download of some information of an entire eLTER network can be made.

Get general information of the network's sites:

Knowing the network elTER id (DEIMS ID of the Network, e.g. LTER-Italy https://deims.org/network/7fef6b73-e5cb-4cd2-b438-ed32eb1504b3), the get_network_sites can download general info, such as name, DEIMS.iD and coordinates of the sites belonging to the network selected. A map of the sites can be returned.

library(dplyr)

listItaSites <- ReLTER::get_network_sites(
 networkDEIMSID =
   "https://deims.org/network/7fef6b73-e5cb-4cd2-b438-ed32eb1504b3"
) %>%
  dplyr::filter(!grepl('^IT', title))

knitr::kable(
  listItaSites[1:10, ],
  caption = "The list of site for LTER-Italy network"
)

listItaSitesMap <- leaflet::leaflet(listItaSites) %>%
  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 = listItaSites,
    radius = 3,
    weight = 2,
    opacity = 0.5,
    fill = TRUE,
    fillOpacity = 0.2
  )
listItaSitesMap

Get other information of the network's sites:

Another 4 functions are been implemented to obtain network's sites information. Each functions get specific information:

The following example perform the request to get all related resources (e.g. activities, datasets, etc.) of the network. The output is a table containing the title, id and time stamp of the last changes of the related resources shared by the network's sites.

listRelatedResources <- ReLTER::get_network_related_resources(
  networkDEIMSID = "https://deims.org/network/7fef6b73-e5cb-4cd2-b438-ed32eb1504b3"
)

# Table of the network's related resources
knitr::kable(
  listRelatedResources,
  caption = "The list of site for LTER-Italy network"
)

By get_site_info function:

Starting by the list of the LTER-Italy network's sites (see first example above), or by using any DEIMS ID list, through the get_site_info function (already described here).

In the example below is proposed the selection, from the list of LTER-Italy sites, only the lakes environments and the map of these sites is made.

library(dplyr)
sites <- as_tibble(
  listItaSites
) %>%
  filter(grepl("Lago", title)) %>%
  filter(!row_number() %in% c(1, 21, 22))

allSiteBound <- lapply(
    as.list(
      sites$uri
    ),
    ReLTER::get_site_info,
    category = "Boundaries"
  )

# Map
sites_map <- leaflet::leaflet(allSiteBound) %>%
  leaflet::addProviderTiles(provider = "CartoDB.PositronNoLabels",
                            group = "Basemap",
                            layerId = 123) %>%
  leaflet::addTiles("http://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}.png")

groups <- length(allSiteBound)

for (i in 1:groups) {
  site_polygon <- allSiteBound[[i]]
  sites_map <- sites_map %>%
    leaflet::addPolygons(
      data = site_polygon,
      popup = ~ title,
      group = i
    )
}
sites_map

Using the same LTER-Italy sites list, the next example provide a contact list of all lake site managers.

library(dplyr)
sites <- as_tibble(
  listItaSites
) %>%
  filter(grepl("Lago", title)) %>%
  filter(!row_number() %in% c(1, 21, 22))

allSiteContact <- lapply(
    as.list(
      sites$uri
    ),
    ReLTER::get_site_info,
    category = "Contacts"
  )
contacts <- tibble::tibble(
  siteName = NA,
  managerName = NA,
  managerEmail = NA,
  managerORCID = NA
)
for (i in seq_len(length(allSiteContact))) {
  contacts <- contacts %>% 
    tibble::add_row(
      siteName = allSiteContact[[i]]$title,
      managerName = allSiteContact[[i]]$generalInfo.siteManager[[1]]$name,
      managerEmail = allSiteContact[[i]]$generalInfo.siteManager[[1]]$email,
      managerORCID = allSiteContact[[i]]$generalInfo.siteManager[[1]]$orcid
    )
}
# Contacts table
knitr::kable(
  contacts,
  caption = "List of the contacts"
)


oggioniale/ReLTER documentation built on Jan. 4, 2024, 3:48 p.m.