crs_engine_proj_sf: Use PROJ via sf to transform coordinates

Description Usage Arguments Value Examples

View source: R/engine-proj-sf.R

Description

The PROJ sf engine is a thin wrapper around sf::st_transform() using sf::sf_proj_pipelines() to query the most appropriate transformation. The interface is similar to that of crs_engine_proj_cmd() to allow a drop-in replacement for most use-cases.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
crs_engine_proj_sf(authority_compliant = TRUE, spatial_test = "intersects")

crs_has_proj_sf()

## S3 method for class 'crs2crs_engine_proj_sf'
crs_engine_proj_pipeline(
  engine,
  handleable,
  crs_to,
  crs_from = wk::wk_crs(handleable),
  bbox = wk::wk_bbox(handleable),
  ...
)

## S3 method for class 'crs2crs_engine_proj_sf'
crs_engine_proj_pipeline_apply(engine, handleable, pipeline, ...)

## S3 method for class 'crs2crs_engine_proj_sf'
crs_engine_transform(
  engine,
  handleable,
  crs_to,
  crs_from = wk::wk_crs(handleable),
  ...
)

Arguments

authority_compliant

Use TRUE or FALSE to apply sf::st_transform() with sf::st_axis_order() temporarily set. The default NA uses whatever the current value of sf::st_axis_order() happens to be at the time of the transform.

spatial_test

Use "none" to skip querying coordinate operations based on bbox. Use "contains" to include only operations that completely contain handleable, or "intersects" for.

engine

A transform engine such as crs_engine_null()

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

bbox

The optional bounding box of the object. Defaults to wk::wk_bbox() of handleable forced to crs_from. Use NULL to skip bounding box selectio for a single transformation.

...

engine-specific transformation options

pipeline

A PROJ coordinate transformation pipeline definition

Value

Examples

1
2
3
4
5
6
7
if (crs_has_proj_sf()) {
  engine <- crs_engine_proj_sf()
  crs_transform(
    wk::xy(-64, 45, crs = "OGC:CRS84"), "EPSG:3857",
    engine = engine
  )
}

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