project_extent: Transform a spatiotemporal extent to a different CRS

Description Usage Arguments Value Examples

View source: R/ebirdst-extent.R

Description

Transform an eBird Status and Trends extent object to a different coordinate reference system. This is most commonly required to transform the extent to the sinusoidal CRS used by the eBird Status and Trends rasters.

Usage

1

Arguments

x

ebirdst_extent object; a spatiotemporal extent.

crs

coordinate references system, given either as a proj4string, an integer EPSG code, or a crs object generated with sf::st_crs().

Value

An ebirdst_extent object in the new CRS.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# construct an ebirdst_extent object
bb_vec <- c(xmin = -80, xmax = -70, ymin = 40, ymax = 47)
bb <- sf::st_bbox(bb_vec, crs = 4326)
bb_ext <- ebirdst_extent(bb)

# transform to sinusoidal projection of rasters
sinu <- "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"
project_extent(bb_ext, crs = sinu)

# also works on polygon extents
poly <- sf::read_sf(system.file("shape/nc.shp", package="sf"))
poly_ext <- ebirdst_extent(poly)
project_extent(poly_ext, crs = sinu)

ebirdst documentation built on Jan. 16, 2021, 5:16 p.m.