crs_transform: Transform Coordinate Reference Systems

Description Usage Arguments Value Examples

View source: R/transform.R

Description

Transform Coordinate Reference Systems

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
crs_transform(
  handleable,
  crs_to,
  crs_from = wk::wk_crs(handleable),
  engine = crs_engine(),
  ...
)

crs_transform_pipeline(handleable, pipeline, engine = crs_engine(), ...)

crs_set_longlat(handleable, datum = NULL, engine = crs_engine())

crs_set(handleable, crs_to)

crs_get(handleable)

Arguments

handleable

A geometry vector (e.g., wkb(), wkt(), xy(), rct(), or sf::st_sfc()) for which wk_handle() is defined.

crs_to

Source and destination coordinate reference systems

crs_from

Source and destination coordinate reference systems

engine

A transform engine such as crs_engine_null()

...

engine-specific transformation options

pipeline

A character vector representing a PROJ coordinate operation

datum

A crs or datum (e.g., WGS84) to use for a long/lat definition

Value

A modified handleable with crs_to.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
engine <- crs_engine_fun()
engine <- crs_engine_fun_define(engine, "EPSG:3857", "OGC:CRS84", function(coords) {
  r <- 6378137
  coords$x <- coords$x * pi / 180 * r
  coords$y <- log(tan(pi / 4 + coords$y * pi / 180 / 2)) * r
  coords
})

obj <- wk::xy(-64, 45, crs = "OGC:CRS84")
crs_transform(obj, "EPSG:3857", engine = engine)

with_crs_engine(engine, {
  crs_transform(obj, "EPSG:3857")
})

paleolimbot/crs2crs documentation built on Jan. 8, 2022, 6:25 a.m.