Map: Module to display Earth Engine (EE) spatial objects

Description Usage Format Details Examples

View source: R/ee_Map.R

Description

Create interactive visualizations of spatial EE objects (ee.Geometry, ee.Image, ee.Feature, and ee.FeatureCollection) through mapview.

Usage

1

Format

An object of class environment with the following functions:

Details

Map takes advantage of getMapId for fetch and return both a mapid and a token suitable to use in a mapview object. To achieve desirable visualization effect, it will depend on the type of spatial EE object . For Image objects, you can provide visualization parameters to Map$addLayer() by using the argument visParams. The parameters available are:

Parameter Description Type
bands Comma-delimited list of three band names to be mapped to RGB list
min Value(s) to map to 0 number or list of three numbers, one for each band
max Value(s) to map to 1 number or list of three numbers, one for each band
gain Value(s) by which to multiply each pixel value number or list of three numbers, one for each band
bias Value(s) to add to each Digital Number (DN) value number or list of three numbers, one for each band
gamma Gamma correction factor(s) number or list of three numbers, one for each band
palette List of CSS-style color strings (single-band images only) comma-separated list of hex strings
opacity The opacity of the layer (0.0 is fully transparent and 1.0 is fully opaque) number

If you add an Image to the map without any additional parameters, by default Map$addLayer() assigns the first three bands to red, green, and blue bands, respectively. The default stretch is based on the min-max range. For Geometry, Feature, and/or FeatureCollection. The available visParams are:

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
## Not run: 
library(rgee)
ee_reattach() # reattach ee as a reserved word
ee_Initialize()

# Case 1: Geometry*
geom <- ee$Geometry$Point(list(-73.53, -15.75))
Map$centerObject(geom, zoom = 13)
m1 <- Map$addLayer(
  eeObject = geom,
  visParams = list(
    pointRadius = 10,
    color = "FF0000"
  ),
  name = "Geometry-Arequipa"
)
# Case 2: Feature
eeobject_fc <- ee$FeatureCollection("users/csaybar/DLdemos/train_set")$
  first()
m2 <- Map$addLayer(
  eeObject = ee$Feature(eeobject_fc),
  name = "Feature-Arequipa"
)
m2 + m1

# Case 3: FeatureCollection
eeobject_fc <- ee$FeatureCollection("users/csaybar/DLdemos/train_set")
Map$centerObject(eeobject_fc)
m3 <- Map$addLayer(eeObject = eeobject_fc, name = "FeatureCollection")
m3 + m2 + m1

# Case 4: Image
image <- ee$Image("LANDSAT/LC08/C01/T1/LC08_044034_20140318")
Map$centerObject(image)
m4 <- Map$addLayer(
  eeObject = image,
  visParams = list(
    bands = c("B4", "B3", "B2"),
    max = 10000
  ),
  name = "SF"
)
m4

## End(Not run)

ryali93/rgee documentation built on May 13, 2020, 4:34 a.m.