Create interactive visualisations of spatial EE objects (Geometry, Image, Feature, FeatureCollection or ImageCollection) base on mapview.

ee_map(eeobject, ...)

# S3 method for default
ee_map(eeobject, ...)

# S3 method for ee.geometry.Geometry
ee_map(eeobject, vizparams, center,
  zoom_start = 8, objname = "map", quiet = FALSE, ...)

# S3 method for ee.feature.Feature
ee_map(eeobject, vizparams, center,
  zoom_start = 8, objname = "map", quiet = FALSE, ...)

# S3 method for ee.featurecollection.FeatureCollection
ee_map(eeobject,
  vizparams, center, zoom_start = 8, objname = "map", quiet = FALSE,
  ...)

# S3 method for ee.image.Image
ee_map(eeobject, vizparams, center,
  zoom_start = 8, objname = "map", quiet = FALSE, ...)

# S3 method for ee.imagecollection.ImageCollection
ee_map(eeobject, vizparams,
  center, zoom_start = 8, objname = "map", max_nimage = 10,
  quiet = FALSE, ...)

Arguments

eeobject

An EE spatial object.

...

Ignored.

vizparams

A list that contains the visualization parameters. See details.

center

The longitude and latitude of the map center. If it is not defined, the centroid of the spatial EE object is taked.

zoom_start

zoom level.

objname

character vector. Name of the map, or maps in case that the EE object be an ImageCollection.

quiet

logical; suppress info messages.

max_nimage

Max number of Image to display.

Details

ee_map takes advantage of the ee$Image()$getMapId python function for fetch and return a mapid and token that is suitable for use in a mapview. To achieve desirable visualization effects, it is depend on the type of spatial EE object . For neither Image or ImageCollection, you can provide visualization parameters to ee_map by the parameter vizparams. The parameters available are:

ParameterDescriptionType
bandsComma-delimited list of three band names to be mapped to RGBlist
minValue(s) to map to 0number or list of three numbers, one for each band
maxValue(s) to map to 1number or list of three numbers, one for each band
gainValue(s) by which to multiply each pixel valuenumber or list of three numbers, one for each band
biasValue(s) to add to each DNnumber or list of three numbers, one for each band
gammaGamma correction factor(s)number or list of three numbers, one for each band
paletteList of CSS-style color strings (single-band images only)comma-separated list of hex strings
opacityThe opacity of the layer (0.0 is fully transparent and 1.0 is fully opaque)number

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

  • color: A hex string in the format RRGGBB specifying the color to use for drawing the features. By default 000000.

  • pointRadius: The radius of the point markers. By default 3.

  • strokeWidth: The width of lines and polygon borders. By default 3.

Examples

if (FALSE) { library(rgee) ee_Initialize() # Case: Geometry* geom <- ee$Geometry$Point(list(-73.53522, -15.75453)) m1 <- ee_map( eeobject = geom, vizparams = list(pointRadius = 10, color = "FF0000"), objname = "Geometry-Arequipa" ) m1 # Case: Feature eeobject_fc <- ee$FeatureCollection("users/csaybar/DLdemos/train_set")$first() m2 <- ee_map(eeobject = ee$Feature(eeobject_fc), objname = "Feature-Arequipa") m2 + m1 # Case: FeatureCollection eeobject_fc <- ee$FeatureCollection("users/csaybar/DLdemos/train_set") m3 <- ee_map(eeobject = eeobject_fc, objname = "FeatureCollection") m3 + m2 + m1 # Case: Image image <- ee$Image("LANDSAT/LC08/C01/T1/LC08_044034_20140318") m4 <- ee_map( eeobject = image, vizparams = list( bands = c("B4", "B3", "B2"), max = 10000 ), objname = "SF", zoom_start = "8" ) m4 # Case: ImageCollection collection <- ee$ImageCollection("LANDSAT/LC08/C01/T1_TOA")$ filter(ee$Filter()$eq("WRS_PATH", 44))$ filter(ee$Filter()$eq("WRS_ROW", 34))$ filterDate("2014-01-01", "2015-01-01")$ sort("CLOUD_COVER") m5 <- ee_map( eeobject = collection, vizparams = list(bands = c("B4", "B3", "B2"), max = 1), objname = c("Scene_2019", "Scene_2016", "Scene_2011"), max_nimage = 3, zoom_start = 10 ) m5 }