Uses the occurrence data (preferably uncleaned) and outputs interactive .html maps that can be opened in your browser to a specific directory. The maps can highlight if an occurrence has passed all filtering (.summary == TRUE) or failed at least one filter (.summary == FALSE). This can be modified by first running summaryFun() to set the columns that you want to be highlighted. It can also highlight occurrences flagged as expert-identified or country outliers.

interactiveMapR(
  data = NULL,
  outPath = NULL,
  lon = "decimalLongitude",
  lat = "decimalLatitude",
  speciesColumn = "scientificName",
  speciesList = NULL,
  countryList = NULL,
  jitterValue = NULL,
  onlySummary = TRUE,
  overWrite = TRUE,
  TrueAlwaysTop = FALSE,
  excludeApis_mellifera = TRUE,
  pointColours = c("blue", "darkred", "#ff7f00", "black")
)

Arguments

data

A data frame or tibble. Occurrence records to use as input.

outPath

A directory as character. Directory where to save output maps.

lon

Character. The name of the longitude column. Default = "decimalLongitude".

lat

Character. The name of the latitude column. Default = "decimalLatitude".

speciesColumn

Character. The name of the column containing species names (or another factor) to build individual maps from. Default = "scientificName".

speciesList

A character vector. Should contain species names as they appear in the speciesColumn to make maps of. User can also specify "ALL" in order to make maps of all species present in the data. Hence, a user may first filter their data and then use "ALL".

countryList

A character vector. Country names to map, or NULL for to map ALL countries.

jitterValue

Numeric. The amount, in decimal degrees, to jitter the map points by - this is important for separating stacked points with the same coordinates.

onlySummary

Logical. If TRUE, the function will not look to plot country or expert-identified outliers in different colours.

overWrite

Logical. If TRUE, the function will overwrite existing files in the provided directory that have the same name. Default = TRUE.

TrueAlwaysTop

If TRUE, the quality (TRUE) points will always be displayed on top of other points. If FALSE, then whichever layer was turned on most-recently will be displayed on top.

excludeApis_mellifera

Logical. If TRUE, will not map records for Apis mellifera. Note: in most cases A. mellifera has too many points, and the resulting map will take a long time to make and be difficult to open. Default = TRUE.

pointColours

A character vector of colours. In order provide colour for TRUE, FALSE, countryOutlier, and customOutlier. Default = c("blue", "darkred","#ff7f00", "black").

Value

Exports .html interactive maps of bee occurrences to the specified directory.

Examples

if(requireNamespace("leaflet")){
OutPath_Figures <- tempdir()

interactiveMapR(
# occurrence data - start with entire dataset, filter down to these species
data = BeeBDC::bees3sp, # %>%
  # Select only those species in the 100 randomly chosen
  # dplyr::filter(scientificName %in% beeData_interactive$scientificName),
  # Select only one species to map
  # dplyr::filter(scientificName %in% "Agapostemon sericeus (Forster, 1771)"),
# Directory where to save files
outPath = paste0(OutPath_Figures, "/interactiveMaps_TEST"),
# lat long columns
lon = "decimalLongitude",
lat = "decimalLatitude",
# Occurrence dataset column with species names
speciesColumn = "scientificName",
# Which species to map - a character vector of names or "ALL"
# Note: "ALL" is defined AFTER filtering for country
speciesList = "ALL",
# studyArea
countryList = NULL, 
# Point jitter to see stacked points - jitters an amount in decimal degrees
jitterValue = 0.01,
# If TRUE, it will only map the .summary column. Otherwise, it will map .summary
# which will be over-written by countryOutliers and manualOutliers
onlySummary = TRUE,
excludeApis_mellifera = TRUE,
overWrite = TRUE,
  # Colours for points which are flagged as TRUE, FALSE, countryOutlier, and customOutlier
pointColours = c("blue", "darkred","#ff7f00", "black")
)
} # END if require
#> Loading required namespace: leaflet
#> The column .expertOutlier was not found. One will be created with all values = TRUE.