Previous steps

If you would like to return to information from the previous section, please click here.

Context

One powerful utility of R is being able to link with remote data sources from taxonomic databases to biodiversity repositories and citizen science initiativees like iNaturalist.

These data platforms can provide complimentary information to coral reef monitoring data, including information on species’ distributional ranges and functional traits. One useful feature of the iNaturalist platform is the link to images of observations, which can be used to verify taxonomy, morphology, and other characteristics (e.g. bleaching status).

This wiki page illustrates an example of using the rinat package for obtaining observations of coral taxa in the Western Indian Ocean region.

Set up

For this example, we start by importing the WIO coastline and setting the geographic extent of the extraction for taxa observations:

  # set dimensions for full regional extract
    lim_n <- (11.0)
    lim_e <- (65.0)
    lim_w <- (18.0)
    lim_s <- (35.0) * -1 # to identify south

  # create extent
    wio_extent <-
      c(lim_s,
        lim_w,
        lim_n,
        lim_e)

We then set the taxa of interest and use the get_inat_obs() function to extract information from the iNaturalist platform:

  # set taxa of interest
    taxa_of_interest <-
      c("Pocillopora")

  # extract
    wio_corals <-
      get_inat_obs(query  = taxa_of_interest,
                   bounds = wio_extent) %>%
      as_tibble()

A quick look at the results provides an idea of the wealth of information associated with each observation:

wio_corals %>% quickview()
 scientific_name                  datetime description                  place_guess
1     Pocillopora 2018-12-21 14:49:00 +0400             La Réunion, Le Pain de Sucre
2     Pocillopora 2021-04-10 11:39:00 +0200                        KwaZulu-Natal, ZA
3     Pocillopora 2021-04-10 11:39:00 +0200                        KwaZulu-Natal, ZA
   latitude longitude                                             tag_list
1 -21.02231  55.22970 Anthozoa, Pocilloporidae, Scleractinia, Hexacorallia
2 -30.37734  30.64560                                               marine
3 -30.26386  30.72401                                               marine
         common_name                                               url
1 Cauliflower Corals https://www.inaturalist.org/observations/82019217
2 Cauliflower Corals https://www.inaturalist.org/observations/73515900
3 Cauliflower Corals https://www.inaturalist.org/observations/73515899
                                                                               image_url
1  https://inaturalist-open-data.s3.amazonaws.com/photos/134578215/medium.jpg?1623073365
2 https://inaturalist-open-data.s3.amazonaws.com/photos/120010712/medium.jpeg?1618072219
3 https://inaturalist-open-data.s3.amazonaws.com/photos/120010694/medium.jpeg?1618072215
  user_login       id      species_guess iconic_taxon_name taxon_id
1     popaul 82019217        Pocillopora          Animalia    60547
2 craigpeter 73515900 Cauliflower Corals          Animalia    60547
3 craigpeter 73515899 Cauliflower Corals          Animalia    60547
  num_identification_agreements num_identification_disagreements       observed_on_string
1                             2                                0         2018-12-21 14:49
2                             1                                0 2021/04/10 11:39 AM SAST
3                             1                                0 2021/04/10 11:39 AM SAST
  observed_on        time_observed_at time_zone positional_accuracy
1  2018-12-21 2018-12-21 10:49:00 UTC Abu Dhabi                 494
2  2021-04-10 2021-04-10 09:39:00 UTC  Pretoria                  25
3  2021-04-10 2021-04-10 09:39:00 UTC  Pretoria                  25
  public_positional_accuracy geoprivacy taxon_geoprivacy coordinates_obscured
1                        494                                            false
2                      29382   obscured                                  true
3                      29382   obscured                                  true
  positioning_method positioning_device user_id              created_at
1                                       4038583 2021-06-07 13:42:46 UTC
2                                        833117 2021-04-10 18:03:35 UTC
3                                        833117 2021-04-10 18:03:35 UTC
               updated_at quality_grade  license sound_url oauth_application_id
1 2021-06-25 19:35:22 UTC      needs_id CC-BY-NC        NA                   NA
2 2021-04-10 19:39:13 UTC      needs_id CC-BY-NC        NA                   NA
3 2021-04-10 19:39:16 UTC      needs_id CC-BY-NC        NA                   NA
  captive_cultivated
1              false
2              false
3              false

Visualise results

Once we have extracted the data, we can pipe %>% to ggplot():

  # visualise
    wio_corals %>%
      ggplot(aes(longitude, latitude)) +
      geom_path(aes(x     = long,
                    y     = lat,
                    group = group),
                colour = "grey75",
                size   = 0.1,
                data   = wio_coastline_f %>%
                           dplyr::filter(long  >= wio_zoom[1],
                                         long  <= wio_zoom[2],
                                         lat   >= wio_zoom[3],
                                         lat   <= wio_zoom[4])) +
        # geom_point(aes(colour = scientific_name),
                   # size = 0.5,
                   # alpha = 0.7) +
        geom_point(size = 0.5, alpha = 0.7) +
        theme_nothing() +
        coord_map(xlim = c(wio_zoom[1] + 0.1, wio_zoom[2] - 0.1),
                  ylim = c(wio_zoom[3] + 0.1, wio_zoom[4] - 0.1)) +
        #facet_wrap(~ scientific_name) +
        scale_colour_manual(values = viridis_pal()(n_palette + 2)) +
        ggtitle(paste0("Observations of ", taxa_of_interest)) +
        theme(legend.position  = "none",
              strip.background = element_blank(),
              strip.text.x     = element_text(size = 6),
              plot.title       = element_text(hjust = 0.5))

And the result should look something like this:

Next steps

There are also cases where coral reef monitoring will require linking with Custom tables, which we will explore here.