ee_ImageCollection_closest: Get the temporal nearest image

View source: R/ee_ImageCollection.R

ee_ImageCollection_closestR Documentation

Get the temporal nearest image

Description

Gets the closest ee$Image to a specified date from an ee$ImageCollection.

Usage

`ee$ImageCollection$Extra_closest(x, ...)`

Arguments

x

ee$ImageCollection from which to get the closest image to the specified date.

...

Additional arguments for finding the nearest image. See details for more information.

Details

The ... argument can include the following:

  • dateee$Date or R date object. Date of interest for searching the closest image.

  • toleranceNumeric. Filters the collection within a range of (date - tolerance, date + tolerance). Default 1.

  • unitCharacter. Units for tolerance. Options include "year", "month", "week", "day", "hour", "minute", "second". Default "month".

These parameters allow for precise control over how the closest image is determined.

Value

An ee$Image closest to the specified date.

Examples

## Not run: 
library(rgee)
library(rgeeExtra)

ee_Initialize()

roi <- ee$Geometry$Point(c(-79, -12))
ee$ImageCollection$Dataset$MODIS_006_MCD12Q1 %>%
  ee$ImageCollection$Extra_closest("2020-10-15",  2, "year") %>%
  ee$ImageCollection$first() %>%
  Map$addLayer()

## End(Not run)

r-earthengine/rgeeExtra documentation built on Dec. 7, 2023, 9:03 p.m.