This function allows users to quickly view a previously created get_*() object.

viz(
  data,
  scale = 250,
  band = NULL,
  palette = "RdBu",
  n_pal = 6,
  reverse = FALSE,
  min = NULL,
  max = NULL,
  gamma = NULL,
  opacity = NULL,
  user_shape = NULL,
  ...
)

Arguments

data

A previously created get_* object

scale

A numeric value indicating scale in meters. 250 (default)

band

A character indicating what bands/type to use when you have more than one. Can select more than one, e.g. c('Red', 'Green', 'Blue').

palette

character color palette using colorBrewer format, e.g. "RdBu" (default), "RdYlGn", etc.

n_pal

numeric indicating levels of colors in palette. 6 (default).

reverse

logical TRUE/FALSE whether to reverse palette or not, FALSE (default).

min

numeric indicating lowest value for viewing.

max

numeric indicating highest value for viewing.

gamma

numeric gamma correction factor.

opacity

numeric transparent display value.

user_shape

A sf object to use as 'aoi/geom' for an 'ee.image.Image'.

...

additional arguments for mapview.

Value

A leaflet map.

Note

This function uses a scale argument which is used to generate a min and max value for viewing. Because this uses getInfo(), it can take a while depending on the scale. Since this is used for viewing, I would suggest to go bigger on the scale. If a user selects more than one band, the 'up-to' three bands will be overlayed like earth engine. When visualizing a get_diff object, black is towards 0, red is negative (-) and green/blue is positive (+).

Examples

if (FALSE) {

# Load Libraries

library(rgee)
rgee::ee_intialize()
library(exploreRGEE)

# Bring in data
huc <- exploreRGEE::huc

ld8 <- get_landsat(huc, method = 'ld8', startDate = '2014-01-01',
                  endDate = '2018-12-31', c.low = 6, c.high = 11)

ld8 %>% viz(scale = 30, band = 'NDVI', palette = 'RdYlGn')

# or without scale, when min and max are used scale is irrelevant.

ld8 %>% viz(min = 0, max = 1, band = 'NDVI', palette = 'RdYlGn')

}