Learn R Programming

sftime (version 0.3.0)

st_crop.sftime: Crop an sftime object to a specific rectangle

Description

Crop an sftime object to a specific rectangle

Usage

# S3 method for sftime
st_crop(x, y, ...)

Value

x cropped using y.

Arguments

x

An object of class sftime.

y

A numeric vector with named elements xmin, ymin, xmax and ymax, or an object of class bbox, or an object for which there is an st_bbox method to convert it to a bbox object.

...

Additional arguments; Ignored.

Details

See st_crop.

Examples

Run this code
# modified from sf:
box <- c(xmin = 0, ymin = 0, xmax = 1, ymax = 1)
pol <- sf::st_sfc(sf::st_buffer(sf::st_point(c(0.5, 0.5)), 0.6))
pol_sftime <- st_sftime(a = 1, geom = pol, time = Sys.time() + 1:2 * 1000)

pol_sftime_cropped <- sf::st_crop(pol_sftime, sf::st_bbox(box))

class(pol_sftime_cropped)
plot(pol_sftime_cropped)

Run the code above in your browser using DataLab