Skip to contents

The input is checked whether its coordinate system is present. If not, it is reprojected to the CRS specified in crs_standard.

Usage

reproject_std(input, crs_standard = "EPSG:4326")

Arguments

input

Input object one of sf or terra::Spat* object

crs_standard

character(1). A standard definition of coordinate reference system. Default is "EPSG:4326" Consult epsg.io for details of other CRS.

Value

A (reprojected) sf or SpatVector object.

Note

This function works well with EPSG codes.

See also

Other Helper functions: datamod(), dep_check(), dep_switch(), get_clip_ext(), par_def_q(), reproject_to_raster()

Author

Insang Song

Examples

if (FALSE) { # \dontrun{
library(sf)
library(terra)
options(sf_use_s2 = FALSE)

base_crs <- "EPSG:5070"
nc_path <- system.file("gpkg/nc.gpkg", package = "sf")
nc_sf <- sf::st_read(nc_path)
reproject_std(nc_sf, base_crs)

nc_vect <- terra::vect(nc_sf)
reproject_std(nc_vect, base_crs)
} # }