interactive_map: Produce an interactive html map

View source: R/interactive_map.R

interactive_mapR Documentation

Produce an interactive html map

Description

Produce an interactive html map.

Usage

interactive_map(
  ras,
  layer_name = NULL,
  palette = "inferno",
  transparency = 0.8,
  legend = TRUE,
  set_value_range = NULL,
  discrete = FALSE,
  scale_type = "none",
  outfile = NULL,
  surveillance_locs = NULL,
  pt_col = "red",
  cleanup = FALSE
)

Arguments

ras

A RasterLayer or file path to a raster file.

layer_name

Character. An optional name to assign to ras.

palette

Either a vector of 2 or more colours (e.g. as hex codes or colour names) or the name of a palette function supported by tmap (see tmaptools::palette_explorer() and tmap::tm_raster()).

transparency

Numeric. Value between 0 and 1 defining the opacity of the plotted raster data (1 = fully opaque; 0 = fully transparent).

legend

Logical. Should a legend be plotted?

set_value_range

A numeric vector giving upper and lower limits for raster values. Values outside this range (including the limits) will be set to NA.

discrete

Logical. Are the values of ras discrete (categorical)?

scale_type

Character. Can be one of: "none" (raw data, no rescaling), "log10", "max normalize" (proportional to maximum value), "minmax normalize" (rescale values to be between 0 and 1 based on min and max) or "logit". Note that if "log10" or "logit" is used, 0 or 1 values must be masked ( using set_value_range) or rescaled before passing to this function. scale_type is ignored if discrete is TRUE.

outfile

Character. If NULL, map will be returned to R and not saved. Otherwise, map will be exported as a html file. Full path address must be used. If pandoc is available, a standalone html file is created (see details).

surveillance_locs

A spatial object or a path to a .csv file containing columns named "Latitude" and "Longitude".

pt_col

Character. The plotting colour for surveillance points.

cleanup

Logical. If a standalone html file is created, should accessory files be removed after the standalone file is generated? This will be a folder created within tempdir().

Details

To create a standalone html file, the pandoc software must be installed and available to R. If pandoc is unavailable, the html file will be accompanied by a folder of accessory files.

Value

A html map.


jscamac/edmaps documentation built on June 11, 2022, 1:26 a.m.