raster_leaflet: Raster Leaflet Map

Description Usage Arguments Details Value Examples

View source: R/raster_leaflet.R

Description

Create a leaflet interactive map using a model output Raster\* object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
raster_leaflet(
  raster,
  index = 1,
  palette = "Spectral",
  breaks = c(0, 12, 35, 55, 150, 250, 350, Inf),
  direction = -1,
  opacity = 0.6,
  maptype = "terrain",
  title = "PM2.5",
  timezone = "UTC",
  compare = NULL,
  index2 = 1
)

Arguments

raster

A Raster\* object.

index

And index into the Raster\* object. See details.

palette

Color palette used to map cell values. This must be either "aqi" or one of the palette names available through ggplot2::scale_colour_brewer().

breaks

The breaks used to map cell values to colors. CURRENTLY UNUSED

direction

Numeric. direction = -1 reverses color palette.

opacity

Opacity of raster layer.

maptype

Name of leaflet ProviderTiles to use.

title

(Optional) A plot title. CURRENTLY UNUSED

timezone

Olson timezone in which times will be displayed.

compare

Optional comparison Raster\* object.

index2

Index of the comparison Raster\* object.

Details

The index is associated with the z axis or time-axis of RasterBrick object, e.g index = 1 is the first hour of a model.

The maptype argument is mapped onto leaflet "ProviderTile" names. Current mappings include:

  1. "roadmap" – "OpenStreetMap"

  2. "satellite" – "Esri.WorldImagery"

  3. "terrain" – "Esri.WorldTopoMap"

  4. "toner" – "Stamen.Toner"

If a character string not listed above is provided, it will be used as the underlying map tile if available. See https://leaflet-extras.github.io/leaflet-providers/ for a list of "provider tiles" to use as the background map.

Value

A leaflet map.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## Not run: 
library(AirFireModeling)
setModelDataDir('~/Data/BlueSky')

# Load consecutive model runs
rasterList <- raster_load(
  modelName = "PNW-4km",
  modelRun = c(2020091300, 2020091400),
  xlim = c(-125, -117),
  ylim = c(42, 47)
)

# Create a leaflet map
raster_leaflet(
  raster = rasterList[[1]],
  index = 3,
  palette = "aqi",
  direction = 1
)

# Create a leaflet map comparing two times from the same run
raster_leaflet(
  raster = rasterList[[1]],
  index = 12,
  compare = rasterList[[1]],
  index2 = 36,
  timezone = "America/Los_Angeles"
)

# Create a leaflet map comparing the same time from two different runs

# Load consecutive model runs
rasterList <- raster_load(
  modelName = c("PNW-4km", "PNW-1.33km"),
  modelRun = 2020091300,
  xlim = c(-125, -117),
  ylim = c(42, 47)
)

raster_leaflet(
  raster = rasterList[[1]],
  index = 12,
  compare = rasterList[[2]],
  index2 = 12,
  timezone = "America/Los_Angeles",
  opacity = 0.3
  )

## End(Not run)

MazamaScience/AirFireModeling documentation built on March 13, 2021, 12:02 a.m.