Create a Leaflet map with the results of an SDM analysis. This map can be explored interactively in the viewer, so its possible to have a better comprehension of the outcomes of your SDM.

sdm_leaflet(
  sdm,
  mode = "bin",
  pts = NULL,
  pal = NULL,
  layernames = NULL,
  crs = "standard",
  cluster = FALSE
)

# S4 method for Raster
sdm_leaflet(
  sdm,
  mode = "bin",
  pts = NULL,
  pal = NULL,
  layernames = NULL,
  crs = "standard",
  cluster = FALSE
)

# S4 method for data.frame
sdm_leaflet(
  sdm,
  mode = "bin",
  pts = NULL,
  pal = NULL,
  layernames = NULL,
  crs = "standard",
  cluster = FALSE
)

Arguments

sdm

The SDM/ENM result (or any other spatial analysis result). Can be either a data.frame (for a single SDM result) or in the Raster* format (multiple layers allowed). Binary maps should have just two values (0 for absence and 1 for presence). Difference maps ("quad" mode, see below) should have 4 values: 0 for unsuitable areas, 1 for areas that were lost, 2 for areas where there was gain of area and 3 for areas where suitability was mantained. Its easy to produce such a map from binary maps. Just multiply the future condition binary map by 2 and sum the current map.

mode

A character string indicating the mode of ploting. Should be one of "bin" (used for thresholded binary SDMs), "quad" (used for ploting difference maps between a binary reference map and a future one) or "continuous" (used for plotting continuous scale data).

pts

A data frame containing the presence or presence/absence points (optional). The first column should be longitude (x) and the sencond latitude (y). In the case of presence/absence data, an additional collumn should be provided, coded as 0 (absence) and 1 (presence).

pal

Character string indicating the name of the palette (see gen_pal). If not supplied, the default will be used.

layernames

An optional character vector indicating the names of the layers. This will be used in the legend. If not supplied, names will be extracted from the RasterLayer.

crs

Enables to change the default projection used in the Leaflet package. For now, not functional.

cluster

Should the points be clustered (i.e., aggregated)? Only valid if `pts` is supplied. Default is FALSE.

Value

A Leaflet map.

Functions

  • sdm_leaflet,Raster-method: Method for Raster*

  • sdm_leaflet,data.frame-method: Method for data frames

Examples

library(sdmvis) # Load data data("thresholded_sdm") data("pa_data") # Set names sdm.names <- c("current", "future") # Plot sdm_leaflet(sdm = thresholded_sdm, mode = "bin", pts = pa_data, layernames = sdm.names)
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: input and ouput crs are the same
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: Some values were outside the color scale and will be treated as NA
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: input and ouput crs are the same
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: Some values were outside the color scale and will be treated as NA